From 51331379178879dc8be8925cebb6890a4f8cf700 Mon Sep 17 00:00:00 2001 From: junchao Date: Sun, 25 Apr 2021 12:05:05 +0800 Subject: [PATCH 1/6] [Mellanox] Support new sensor conf file for MSN4700 A1/A0 --- .../get_sensors_conf_path | 21 +++ .../x86_64-mlnx_msn4700-r0/sensors.conf.new | 142 ++++++++++++++++++ .../docker-platform-monitor/docker_init.sh | 7 +- 3 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path create mode 100644 device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path new file mode 100644 index 000000000000..5ad4bdafeb95 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path @@ -0,0 +1,21 @@ +#!/bin/bash + +HW_VERSION="/var/run/hw-management/system/config1" +SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" +SENSORS_CONF_FILE_NEW="/usr/share/sonic/platform/sensors.conf.new" + +function get_sensor_conf_path() { + local _HW_VERSION="0" + if [[ -e $HW_VERSION ]]; then + _HW_VERSION=$(cat $HW_VERSION 2>&1) + if [[ "$_HW_VERSION" == "1" ]]; then + if [[ -e $SENSORS_CONF_FILE_NEW ]]; then + echo $SENSORS_CONF_FILE_NEW + return + fi + fi + fi + echo $SENSORS_CONF_FILE +} + +get_sensor_conf_path diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new new file mode 100644 index 000000000000..5accf4b669ef --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new @@ -0,0 +1,142 @@ +################################################################################ +# Copyright (c) 2019 Mellanox Technologies +# +# Platform specific sensors config for SN4700 A0/A1 +################################################################################ + +# Temperature sensors +bus "i2c-2" "i2c-1-mux (chan_id 1)" + chip "mlxsw-i2c-*-48" + label temp1 "Ambient ASIC Temp" + +bus "i2c-7" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-*-49" + label temp1 "Ambient Fan Side Temp (air intake)" + chip "tmp102-i2c-*-4a" + label temp1 "Ambient Port Side Temp (air exhaust)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-15-49" + label temp1 "Ambient COMEX Temp" + +# Power controllers +bus "i2c-5" "i2c-1-mux (chan_id 4)" + chip "mp2975-i2c-*-62" + label in1 "PMIC-1 PSU 12V Rail (in1)" + label in2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail (out)" + label temp1 "PMIC-1 Temp 1" + label power1 "PMIC-1 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail Pwr (out)" + label curr1 "PMIC-1 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail Curr (out)" + chip "mp2975-i2c-*-64" + label in1 "PMIC-2 PSU 12V Rail (in1)" + label in2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail (out)" + label in3 "PMIC-2 ASIC 1.2V VCORE MAIN Rail (out)" + label temp1 "PMIC-2 Temp 1" + label power1 "PMIC-2 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail Pwr (out)" + label curr1 "PMIC-2 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail Curr (out)" + label curr3 "PMIC-2 ASIC 1.2V VCORE MAIN Rail Curr (out)" + chip "mp2975-i2c-*-66" + label in1 "PMIC-3 PSU 12V Rail (in1)" + label in2 "PMIC-3 ASIC 0.85V T0_1 Rail (out)" + label in3 "PMIC-3 ASIC 1.8V T0_1 Rail (out)" + label temp1 "PMIC-3 Temp 1" + label power1 "PMIC-3 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-3 ASIC 0.85V T0_1 Rail Pwr (out)" + label curr1 "PMIC-3 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-3 ASIC 0.85V T0_1 Rail Curr (out)" + label curr3 "PMIC-3 ASIC 1.8V T0_1 Rail Curr (out)" + chip "mp2975-i2c-*-6a" + label in1 "PMIC-4 PSU 12V Rail (in1)" + label in2 "PMIC-4 ASIC 0.85V T2_3 Rail (out)" + label in3 "PMIC-4 ASIC 1.8V T2_3 Rail (out)" + label temp1 "PMIC-4 Temp 1" + label power1 "PMIC-4 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-4 ASIC 0.85V T2_3 Rail Pwr (out)" + label curr1 "PMIC-4 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-4 ASIC 0.85V T2_3 Rail Curr (out)" + label curr3 "PMIC-4 ASIC 1.8V T2_3 Rail Curr (out)" + chip "mp2975-i2c-*-6e" + label in1 "PMIC-5 PSU 12V Rail (in1)" + label in2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 (out)" + label in3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 (out)" + label temp1 "PMIC-5 Temp 1" + label power1 "PMIC-5 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 Pwr (out)" + label power3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 Pwr (out)" + label curr1 "PMIC-5 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 Curr (out)" + label curr3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 Curr (out)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tps53679-i2c-*-58" + label in1 "PMIC-8 PSU 12V Rail (in1)" + label in2 "PMIC-8 PSU 12V Rail (in2)" + label in3 "PMIC-8 COMEX 1.8V Rail (out)" + label in4 "PMIC-8 COMEX 1.05V Rail (out)" + label temp1 "PMIC-8 Temp 1" + label temp2 "PMIC-8 Temp 2" + label power1 "PMIC-8 COMEX 1.8V Rail Pwr (out)" + label power2 "PMIC-8 COMEX 1.05V Rail Pwr (out)" + label curr1 "PMIC-8 COMEX 1.8V Rail Curr (out)" + label curr2 "PMIC-8 COMEX 1.05V Rail Curr (out)" + chip "tps53679-i2c-*-61" + label in1 "PMIC-9 PSU 12V Rail (in1)" + label in2 "PMIC-9 PSU 12V Rail (in2)" + label in3 "PMIC-9 COMEX 1.2V Rail (out)" + ignore in4 + label temp1 "PMIC-9 Temp 1" + label temp2 "PMIC-9 Temp 2" + label power1 "PMIC-9 COMEX 1.2V Rail Pwr (out)" + ignore power2 + label curr1 "PMIC-9 COMEX 1.2V Rail Curr (out)" + ignore curr2 + +# Power supplies +bus "i2c-4" "i2c-1-mux (chan_id 3)" + chip "dps460-i2c-*-58" + label in1 "PSU-1(L) 220V Rail (in)" + ignore in2 + label in3 "PSU-1(L) 12V Rail (out)" + label fan1 "PSU-1(L) Fan 1" + label temp1 "PSU-1(L) Temp 1" + label temp2 "PSU-1(L) Temp 2" + label temp3 "PSU-1(L) Temp 3" + label power1 "PSU-1(L) 220V Rail Pwr (in)" + label power2 "PSU-1(L) 12V Rail Pwr (out)" + label curr1 "PSU-1(L) 220V Rail Curr (in)" + label curr2 "PSU-1(L) 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-2(R) 220V Rail (in)" + ignore in2 + label in3 "PSU-2(R) 12V Rail (out)" + label fan1 "PSU-2(R) Fan 1" + label temp1 "PSU-2(R) Temp 1" + label temp2 "PSU-2(R) Temp 2" + label temp3 "PSU-2(R) Temp 3" + label power1 "PSU-2(R) 220V Rail Pwr (in)" + label power2 "PSU-2(R) 12V Rail Pwr (out)" + label curr1 "PSU-2(R) 220V Rail Curr (in)" + label curr2 "PSU-2(R) 12V Rail Curr (out)" + +# Chassis fans +chip "mlxreg_fan-isa-*" + label fan1 "Chassis Fan Drawer-1 Tach 1" + label fan2 "Chassis Fan Drawer-1 Tach 2" + label fan3 "Chassis Fan Drawer-2 Tach 1" + label fan4 "Chassis Fan Drawer-2 Tach 2" + label fan5 "Chassis Fan Drawer-3 Tach 1" + label fan6 "Chassis Fan Drawer-3 Tach 2" + label fan7 "Chassis Fan Drawer-4 Tach 1" + label fan8 "Chassis Fan Drawer-4 Tach 2" + label fan9 "Chassis Fan Drawer-5 Tach 1" + label fan10 "Chassis Fan Drawer-5 Tach 2" + label fan11 "Chassis Fan Drawer-6 Tach 1" + label fan12 "Chassis Fan Drawer-6 Tach 2" + +# Miscellaneous +chip "*-virtual-*" + ignore temp1 diff --git a/dockers/docker-platform-monitor/docker_init.sh b/dockers/docker-platform-monitor/docker_init.sh index 6fc7ffeb5114..5aaae7f810b7 100755 --- a/dockers/docker-platform-monitor/docker_init.sh +++ b/dockers/docker-platform-monitor/docker_init.sh @@ -4,6 +4,7 @@ mkdir -p /etc/supervisor/conf.d/ SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" +SENSORS_CONF_PATH_GETTER="/usr/share/sonic/platform/get_sensors_conf_path" FANCONTROL_CONF_FILE="/usr/share/sonic/platform/fancontrol" SUPERVISOR_CONF_TEMPLATE="/usr/share/sonic/templates/docker-pmon.supervisord.conf.j2" @@ -78,10 +79,14 @@ else SONIC_PLATFORM_API_PYTHON_VERSION=3 fi +if [ -e $SENSORS_CONF_PATH_GETTER ]; then + SENSORS_CONF_FILE=$($SENSORS_CONF_PATH_GETTER 2>&1) +fi + if [ -e $SENSORS_CONF_FILE ]; then HAVE_SENSORS_CONF=1 mkdir -p /etc/sensors.d - /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/ + /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/sensors.conf fi if [ -e $FANCONTROL_CONF_FILE ]; then From 59e097b1875a8cffb4f41c0db48ca55087390e0e Mon Sep 17 00:00:00 2001 From: junchao Date: Mon, 26 Apr 2021 15:02:14 +0800 Subject: [PATCH 2/6] Fix review comment --- dockers/docker-platform-monitor/Dockerfile.j2 | 8 ++++++-- .../{docker_init.sh => docker_init.j2} | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) rename dockers/docker-platform-monitor/{docker_init.sh => docker_init.j2} (98%) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index e86f4ad0019b..8c9c7dba8893 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -84,10 +84,14 @@ RUN apt-get purge -y \ /python-wheels \ ~/.cache -COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"] -COPY ["docker-pmon.supervisord.conf.j2", "/usr/share/sonic/templates/"] +COPY ["lm-sensors.sh", "/usr/bin/"] +COPY ["docker-pmon.supervisord.conf.j2", "docker_init.j2", "/usr/share/sonic/templates/"] COPY ["ssd_tools/*", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +RUN sonic-cfggen -a "{\"CONFIGURED_PLATFORM\":\"{{CONFIGURED_PLATFORM}}\"}" -t /usr/share/sonic/templates/docker_init.j2 > /usr/bin/docker_init.sh +RUN rm -f /usr/share/sonic/templates/docker_init.j2 +Run chmod 755 /usr/bin/docker_init.sh + ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-platform-monitor/docker_init.sh b/dockers/docker-platform-monitor/docker_init.j2 similarity index 98% rename from dockers/docker-platform-monitor/docker_init.sh rename to dockers/docker-platform-monitor/docker_init.j2 index 5aaae7f810b7..1d22e19b239b 100755 --- a/dockers/docker-platform-monitor/docker_init.sh +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -4,7 +4,6 @@ mkdir -p /etc/supervisor/conf.d/ SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" -SENSORS_CONF_PATH_GETTER="/usr/share/sonic/platform/get_sensors_conf_path" FANCONTROL_CONF_FILE="/usr/share/sonic/platform/fancontrol" SUPERVISOR_CONF_TEMPLATE="/usr/share/sonic/templates/docker-pmon.supervisord.conf.j2" @@ -79,9 +78,12 @@ else SONIC_PLATFORM_API_PYTHON_VERSION=3 fi +{% if CONFIGURED_PLATFORM == "mellanox" %} +SENSORS_CONF_PATH_GETTER="/usr/share/sonic/platform/get_sensors_conf_path" if [ -e $SENSORS_CONF_PATH_GETTER ]; then SENSORS_CONF_FILE=$($SENSORS_CONF_PATH_GETTER 2>&1) fi +{% endif %} if [ -e $SENSORS_CONF_FILE ]; then HAVE_SENSORS_CONF=1 From 46ae44475d5c3f3d728e55ce8569e9d5dec2958b Mon Sep 17 00:00:00 2001 From: junchao Date: Tue, 27 Apr 2021 09:57:50 +0800 Subject: [PATCH 3/6] Fix review comment --- device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path | 2 +- .../{sensors.conf.new => sensors.conf.a1} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename device/mellanox/x86_64-mlnx_msn4700-r0/{sensors.conf.new => sensors.conf.a1} (100%) diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path index 5ad4bdafeb95..27cbae64924b 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path @@ -2,7 +2,7 @@ HW_VERSION="/var/run/hw-management/system/config1" SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" -SENSORS_CONF_FILE_NEW="/usr/share/sonic/platform/sensors.conf.new" +SENSORS_CONF_FILE_NEW="/usr/share/sonic/platform/sensors.conf.a1" function get_sensor_conf_path() { local _HW_VERSION="0" diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.new rename to device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 From 94c1c6662d5b5af292daf9f5b82bbd8dc2667c24 Mon Sep 17 00:00:00 2001 From: junchao Date: Wed, 28 Apr 2021 09:33:36 +0800 Subject: [PATCH 4/6] Fix review comment --- .../mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path index 27cbae64924b..c347d7435416 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path @@ -2,15 +2,15 @@ HW_VERSION="/var/run/hw-management/system/config1" SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf" -SENSORS_CONF_FILE_NEW="/usr/share/sonic/platform/sensors.conf.a1" +SENSORS_CONF_FILE_A1="/usr/share/sonic/platform/sensors.conf.a1" function get_sensor_conf_path() { local _HW_VERSION="0" if [[ -e $HW_VERSION ]]; then _HW_VERSION=$(cat $HW_VERSION 2>&1) if [[ "$_HW_VERSION" == "1" ]]; then - if [[ -e $SENSORS_CONF_FILE_NEW ]]; then - echo $SENSORS_CONF_FILE_NEW + if [[ -e $SENSORS_CONF_FILE_A1 ]]; then + echo $SENSORS_CONF_FILE_A1 return fi fi From 380621e960be6b263e4ede6ef1b26cd107921830 Mon Sep 17 00:00:00 2001 From: junchao Date: Thu, 29 Apr 2021 10:30:27 +0800 Subject: [PATCH 5/6] Change mode for get_sensors_conf_path --- device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4700-r0/get_sensors_conf_path old mode 100644 new mode 100755 From 215b12019fb0b8ab170475e1fd9902537aee446b Mon Sep 17 00:00:00 2001 From: junchao Date: Thu, 29 Apr 2021 10:48:32 +0800 Subject: [PATCH 6/6] Fix typo --- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 8c9c7dba8893..7e8d75680fa8 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -92,6 +92,6 @@ COPY ["critical_processes", "/etc/supervisor"] RUN sonic-cfggen -a "{\"CONFIGURED_PLATFORM\":\"{{CONFIGURED_PLATFORM}}\"}" -t /usr/share/sonic/templates/docker_init.j2 > /usr/bin/docker_init.sh RUN rm -f /usr/share/sonic/templates/docker_init.j2 -Run chmod 755 /usr/bin/docker_init.sh +RUN chmod 755 /usr/bin/docker_init.sh ENTRYPOINT ["/usr/bin/docker_init.sh"]