Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Marvell platform #765

Merged
merged 2 commits into from
Aug 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions platform/marvell/docker-orchagent-mrvl.mk
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions platform/marvell/docker-syncd-mrvl-rpc.mk
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions platform/marvell/docker-syncd-mrvl-rpc/99-syncd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sysctl -w net.core.rmem_max=509430500

51 changes: 51 additions & 0 deletions platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 10 additions & 0 deletions platform/marvell/docker-syncd-mrvl-rpc/ptf_nn_agent.conf
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions platform/marvell/docker-syncd-mrvl.mk
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions platform/marvell/docker-syncd-mrvl/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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"]

8 changes: 8 additions & 0 deletions platform/marvell/docker-syncd-mrvl/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

rm -f /var/run/rsyslogd.pid

supervisorctl start rsyslogd

supervisorctl start syncd

29 changes: 29 additions & 0 deletions platform/marvell/docker-syncd-mrvl/supervisord.conf
Original file line number Diff line number Diff line change
@@ -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

12 changes: 12 additions & 0 deletions platform/marvell/docker-syncd-mrvl/syncd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

function clean_up {
service syncd stop
exit
}

trap clean_up SIGTERM SIGKILL

service syncd start

read
7 changes: 7 additions & 0 deletions platform/marvell/libsaithrift-dev.mk
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions platform/marvell/one-image.mk
Original file line number Diff line number Diff line change
@@ -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)
Empty file.
6 changes: 6 additions & 0 deletions platform/marvell/python-saithrift.mk
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions platform/marvell/rules.mk
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions platform/marvell/sai.mk
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions platform/marvell/sai/Makefile
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions platform/marvell/sdk.mk
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions platform/marvell/sdk/Makefile
Original file line number Diff line number Diff line change
@@ -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)