From 2ca494dc45faa0560344d5d00e5bfd62a2fc26bc Mon Sep 17 00:00:00 2001 From: Keshav Gupta Date: Fri, 9 Aug 2024 04:06:01 +0530 Subject: [PATCH] Fix Innovium build for SONIC 202211 (#17613) * Add platform files for Marvell Innovium platform Add platform files for critical processes and default qos config for Innovium platforms * Fix Marvell innovium build for SONiC202211 * Add debug shell packages for Marvell Innovium platforms --- platform/innovium/docker-syncd-invm-rpc.mk | 3 +- .../docker-syncd-invm-rpc/Dockerfile.j2 | 18 ++++----- platform/innovium/docker-syncd-invm.mk | 8 ++-- .../innovium/docker-syncd-invm/Dockerfile.j2 | 6 ++- .../docker-syncd-invm/critical_processes | 1 + .../innovium/docker-syncd-invm/ivm_start.sh | 39 +++++++++++++++++++ platform/innovium/docker-syncd-invm/start.sh | 6 +++ platform/innovium/invm-sai.mk | 6 ++- platform/innovium/rules.mk | 6 +-- 9 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 platform/innovium/docker-syncd-invm/critical_processes create mode 100755 platform/innovium/docker-syncd-invm/ivm_start.sh create mode 100755 platform/innovium/docker-syncd-invm/start.sh diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 8ccbef57dd4f..5162242952af 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -2,7 +2,8 @@ DOCKER_SYNCD_INVM_RPC = docker-syncd-invm-rpc.gz $(DOCKER_SYNCD_INVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-invm-rpc -$(DOCKER_SYNCD_INVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(INVM_LIBSAI) $(PTF) +$(DOCKER_SYNCD_INVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(INVM_LIBSAI) $(PTF) $(INVM_SHELL) +$(DOCKER_SYNCD_INVM_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_SYNCD_INVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) diff --git a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 index 5ad93088c7eb..b2c3d0248894 100755 --- a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 @@ -9,24 +9,25 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN dpkg -P syncd +RUN apt-get purge -y syncd ## Pre-install the fundamental packages RUN apt-get update \ && apt-get -y install \ net-tools \ - python-pip \ + python3-pip \ + python-setuptools \ build-essential \ libssl-dev \ libffi-dev \ python-dev \ - libpython2.7 \ libjansson4 \ + libyaml-dev \ wget \ cmake \ libqt5core5a \ libqt5network5 \ - libboost-atomic1.71.0 + libboost-atomic1.74.0 RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ {% for deb in docker_syncd_invm_rpc_debs.split(' ') -%} @@ -43,12 +44,9 @@ RUN wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && 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 \ - && pip install numpy \ - && pip install scipy \ - && pip install setuptools \ + && pip3 install numpy \ + && pip3 install scipy \ + && pip3 install setuptools \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk index f500515c56e3..d3c68fbf6088 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -1,19 +1,17 @@ # docker image for innovium syncd DOCKER_SYNCD_PLATFORM_CODE = invm -include $(PLATFORM_PATH)/../template/docker-syncd-base.mk +include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk -$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(INVM_LIBSAI) +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(INVM_LIBSAI) $(INVM_SHELL) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) -SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) -SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) - $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd +$(DOCKER_SYNCD_BASE)_MACHINE = innovium $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index 0811d044b02b..a2bd57dc3926 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM docker-config-engine-stretch-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name @@ -15,8 +16,9 @@ debs/ # Needed for Innovium Debug Shell RUN apt-get install -y net-tools -RUN apt-get install -y libpython2.7 RUN apt-get install -y libjansson4 +RUN apt-get install -y libyaml-dev +RUN pip3 install numpy RUN dpkg -i \ {% for deb in docker_syncd_invm_debs.split(' ') -%} diff --git a/platform/innovium/docker-syncd-invm/critical_processes b/platform/innovium/docker-syncd-invm/critical_processes new file mode 100644 index 000000000000..bdd6903c5690 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/critical_processes @@ -0,0 +1 @@ +program:syncd diff --git a/platform/innovium/docker-syncd-invm/ivm_start.sh b/platform/innovium/docker-syncd-invm/ivm_start.sh new file mode 100755 index 000000000000..896d209702f8 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/ivm_start.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +TOPO_CONF=/usr/share/sonic/platform/topo.conf +if [ -f ${TOPO_CONF} ]; then + topo=`cat ${TOPO_CONF}` +else + topo="none" +fi + +if [ ${topo} != "none" ]; then + BUFFER_CONFIG=/usr/share/sonic/hwsku/buffers_defaults_${topo}.j2 + QOS_CONFIG=/usr/share/sonic/hwsku/qos_defaults_${topo}.j2 + + if [ "$(/usr/local/bin/sonic-cfggen -d -v TC_TO_PRIORITY_GROUP_MAP)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v MAP_PFC_PRIORITY_TO_QUEUE)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v TC_TO_QUEUE_MAP)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v DSCP_TO_TC_MAP)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v SCHEDULER)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v PFC_PRIORITY_TO_PRIORITY_GROUP_MAP)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v PORT_QOS_MAP)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v WRED_PROFILE)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v QUEUE)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v CABLE_LENGTH)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v BUFFER_POOL)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v BUFFER_PROFILE)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v BUFFER_PG)" ] || \ + [ "$(/usr/local/bin/sonic-cfggen -d -v BUFFER_QUEUE)" ]; then + echo "Database has QoS settings, skip loading defaults" + elif [ -f "$BUFFER_CONFIG" ] && [ -f "$QOS_CONFIG" ]; then + /usr/local/bin/sonic-cfggen -d -t $BUFFER_CONFIG >/tmp/buffers.json + /usr/local/bin/sonic-cfggen -d -t $QOS_CONFIG -y /etc/sonic/sonic_version.yml >/tmp/qos.json + /usr/local/bin/sonic-cfggen -j /tmp/buffers.json --write-to-db + /usr/local/bin/sonic-cfggen -j /tmp/qos.json --write-to-db + else + echo "File not found (${BUFFER_CONFIG} and/or ${QOS_CONFIG})" + fi +else + echo "Skip QoS config" +fi diff --git a/platform/innovium/docker-syncd-invm/start.sh b/platform/innovium/docker-syncd-invm/start.sh new file mode 100755 index 000000000000..32bdb12ebfc0 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +if [ -f /usr/bin/ivm_start.sh ]; +then + /usr/bin/ivm_start.sh +fi diff --git a/platform/innovium/invm-sai.mk b/platform/innovium/invm-sai.mk index 25e490e44f83..02719e0807c1 100755 --- a/platform/innovium/invm-sai.mk +++ b/platform/innovium/invm-sai.mk @@ -1,15 +1,17 @@ # INVM SAI -INVM_SAI_ONLINE = https://github.com/Innovium/SONiC/raw/master/debian/master +INVM_SAI_ONLINE = https://github.com/Innovium/SONiC/raw/master/debian/202211 INVM_LIBSAI = isai.deb INVM_HSAI = saihdr.deb INVM_DRV = ipd.deb +INVM_SHELL = ishell.deb $(INVM_LIBSAI)_URL = $(INVM_SAI_ONLINE)/$(INVM_LIBSAI) $(INVM_HSAI)_URL = $(INVM_SAI_ONLINE)/$(INVM_HSAI) $(INVM_DRV)_URL = $(INVM_SAI_ONLINE)/$(INVM_DRV) +$(INVM_SHELL)_URL = $(INVM_SAI_ONLINE)/$(INVM_SHELL) $(eval $(call add_conflict_package,$(INVM_HSAI),$(LIBSAIVS_DEV))) -SONIC_ONLINE_DEBS += $(INVM_LIBSAI) $(INVM_HSAI) $(INVM_DRV) +SONIC_ONLINE_DEBS += $(INVM_LIBSAI) $(INVM_HSAI) $(INVM_DRV) $(INVM_SHELL) diff --git a/platform/innovium/rules.mk b/platform/innovium/rules.mk index 39e695575326..350ab8ef3f80 100755 --- a/platform/innovium/rules.mk +++ b/platform/innovium/rules.mk @@ -1,8 +1,8 @@ include $(PLATFORM_PATH)/invm-sai.mk include $(PLATFORM_PATH)/platform-modules-cel.mk -include $(PLATFORM_PATH)/platform-modules-delta.mk +#include $(PLATFORM_PATH)/platform-modules-delta.mk include $(PLATFORM_PATH)/platform-modules-wistron.mk -include $(PLATFORM_PATH)/platform-modules-netberg.mk +#include $(PLATFORM_PATH)/platform-modules-netberg.mk include $(PLATFORM_PATH)/docker-syncd-invm.mk include $(PLATFORM_PATH)/docker-syncd-invm-rpc.mk include $(PLATFORM_PATH)/one-image.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_INVM_ONE_IMAGE) \ $(DOCKER_SYNCD_INVM_RPC) # Inject invm sai into syncd -$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV_INVM) +$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV_INVM) $(INVM_SHELL) $(SYNCD)_UNINSTALLS += $(INVM_HSAI) # Runtime dependency on invm sai is set only for syncd