-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[gearbox] Add gbsyncd container for Credo gearbox chips #8144
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a9d80e7
Add gbsyncd container for Credo gearbox chips
byu343 dfaea82
Change to psai.profile
byu343 b4046fc
Separate gbsyncd-credo service
byu343 f36105a
Fix docker-gbsyncd-vs build
byu343 f8f2189
Add CREDO_DEVICE_PATH for loading library
byu343 9cceb85
Change pkg name for credo libraries
byu343 819aada
Fix issue found in kvmtest
byu343 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gbsyncd.service.j2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# Check the gbsyncd platform defined on the device matching the service, | ||
# or otherwise skip starting the service | ||
|
||
SERVICE="$gbsyncd_platform" | ||
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} | ||
DEVPATH="/usr/share/sonic/device" | ||
CONFIGFILE="${DEVPATH}/${PLATFORM}/gbsyncd.ini" | ||
|
||
if [ ! -f "$CONFIGFILE" ]; then | ||
if [ gbsyncd = "$SERVICE" ]; then | ||
exit 0 | ||
fi | ||
exit 1 | ||
fi | ||
|
||
while IFS="=" read -r key value; do | ||
case "$key" in | ||
platform) | ||
if [ "$value" = "$SERVICE" ]; then | ||
exit 0 | ||
fi | ||
;; | ||
esac | ||
done < "$CONFIGFILE" | ||
|
||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DPATH := $($(DOCKER_GBSYNCD_BASE)_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) | ||
DEP_FILES += platform/components/docker-gbsyncd-credo.mk | ||
DEP_FILES += platform/components/docker-gbsyncd-credo.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
DEP_FILES += $(shell git ls-files $(DPATH)) | ||
|
||
$(DOCKER_GBSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(DOCKER_GBSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(DOCKER_GBSYNCD_BASE)_DEP_FILES := $(DEP_FILES) | ||
|
||
$(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_BASE),$(DOCKER_GBSYNCD_BASE_DBG))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DOCKER_GBSYNCD_PLATFORM_CODE = credo | ||
|
||
LIBSAI_CREDO = libsaicredo_0.5.1-alpha.2_amd64.deb | ||
$(LIBSAI_CREDO)_URL = | ||
LIBSAI_CREDO_OWL = libsaicredo-owl_0.5.1-alpha.2_amd64.deb | ||
$(LIBSAI_CREDO_OWL)_URL = | ||
|
||
ifneq ($($(LIBSAI_CREDO)_URL),) | ||
include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk | ||
$(DOCKER_GBSYNCD_BASE)_CONTAINER_NAME = gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) | ||
$(DOCKER_GBSYNCD_BASE)_PATH = $(PLATFORM_PATH)/../components/docker-gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) | ||
SONIC_ONLINE_DEBS += $(LIBSAI_CREDO) $(LIBSAI_CREDO_OWL) | ||
$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD) $(LIBSAI_CREDO) $(LIBSAI_CREDO_OWL) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM docker-config-engine-buster | ||
|
||
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 | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -f -y iproute2 libcap2-bin libprotobuf-dev | ||
|
||
COPY \ | ||
{% for deb in docker_gbsyncd_credo_debs.split(' ') -%} | ||
{% if 'libsaibcm' not in deb -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endif %} | ||
{%- endfor -%} | ||
debs/ | ||
|
||
RUN dpkg -i \ | ||
{% for deb in docker_gbsyncd_credo_debs.split(' ') -%} | ||
{% if 'libsaibcm' not in deb -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endif %} | ||
{%- endfor %} | ||
|
||
COPY ["docker-init.sh", "/usr/bin/"] | ||
COPY ["start.sh", "/usr/bin/"] | ||
|
||
COPY ["critical_processes.j2", "/usr/share/sonic/templates"] | ||
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates"] | ||
|
||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] | ||
|
||
## Clean up | ||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
ENTRYPOINT ["/usr/bin/docker-init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
program:syncd | ||
lguohan marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /bin/sh | ||
|
||
GB_CONFIG=/usr/share/sonic/hwsku/gearbox_config.json | ||
|
||
if [ ! -f $GB_CONFIG ]; then | ||
exit 0 | ||
fi | ||
|
||
CFGGEN_ARG="-j $GB_CONFIG" | ||
|
||
mkdir -p /etc/supervisor/conf.d/ | ||
|
||
sonic-cfggen $CFGGEN_ARG -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf | ||
sonic-cfggen $CFGGEN_ARG -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes | ||
|
||
exec /usr/local/bin/supervisord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
HWSKU_DIR=/usr/share/sonic/hwsku | ||
|
||
mkdir -p /etc/sai.d/ | ||
|
||
# Create/Copy the psai.profile to /etc/sai.d/psai.profile | ||
if [ -f $HWSKU_DIR/psai.profile.j2 ]; then | ||
sonic-cfggen -d -t $HWSKU_DIR/psai.profile.j2 > /etc/sai.d/psai.profile | ||
else | ||
if [ -f $HWSKU_DIR/psai.profile ]; then | ||
cp $HWSKU_DIR/psai.profile /etc/sai.d/psai.profile | ||
fi | ||
fi |
43 changes: 43 additions & 0 deletions
43
platform/components/docker-gbsyncd-credo/supervisord.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[eventlistener:dependent-startup] | ||
command=python3 -m supervisord_dependent_startup | ||
autostart=true | ||
autorestart=unexpected | ||
startretries=0 | ||
exitcodes=0,3 | ||
events=PROCESS_STATE | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n -iNONE | ||
priority=1 | ||
autostart=false | ||
autorestart=unexpected | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
|
||
[program:start] | ||
command=/usr/bin/start.sh | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
startsecs=0 | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
||
[program:syncd] | ||
environment=CREDO_DEVICE_PATH=/usr/lib | ||
command=/usr/bin/syncd -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1 | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=start:exited |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why we have saibcm here.