Skip to content

Commit

Permalink
Support for platforms based on Barefoot Networks' device (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsunkad authored and lguohan committed Mar 14, 2018
1 parent 3b817bb commit c591e38
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ AC_PROG_CXX
AC_PROG_LIBTOOL
AC_HEADER_STDC

AM_CONDITIONAL(sonic_asic_platform_barefoot, test x$CONFIGURED_PLATFORM = xbarefoot)

AC_ARG_ENABLE(debug,
[ --enable-debug turn on debugging],
[case "${enableval}" in
Expand Down
4 changes: 4 additions & 0 deletions saidiscovery/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ endif
if SAIVS
SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs
else
if sonic_asic_platform_barefoot
SAILIB=-L/opt/bfn/install/lib -lswitchsai -lswitchapi -lbf_switchd_lib -ltofinopdfixed_thrift -ldriver -lbfutils -lbfsys -lbfutils -L/opt/bfn/install/lib/tofinopd/switch -lpd -lpdcli -lpdthrift
else
SAILIB=-lsai
endif
endif

saidiscovery_SOURCES = saidiscovery.cpp

Expand Down
5 changes: 5 additions & 0 deletions saisdkdump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ else
DBGFLAGS = -g
endif


if SAIVS
SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs
else
if sonic_asic_platform_barefoot
SAILIB=-L/opt/bfn/install/lib -lswitchsai -lswitchapi -lbf_switchd_lib -ltofinopdfixed_thrift -ldriver -lbfutils -lbfsys -lbfutils -L/opt/bfn/install/lib/tofinopd/switch -lpd -lpdcli -lpdthrift
else
SAILIB=-lsai
endif
endif

saisdkdump_SOURCES = saisdkdump.cpp
saisdkdump_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) $(SAIFLAGS)
Expand Down
4 changes: 4 additions & 0 deletions syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ endif
if SAIVS
SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs
else
if sonic_asic_platform_barefoot
SAILIB=-L/opt/bfn/install/lib -lswitchsai -lswitchapi -lbf_switchd_lib -ltofinopdfixed_thrift -ldriver -lbfutils -lbfsys -lbfutils -L/opt/bfn/install/lib/tofinopd/switch -lpd -lpdcli -lpdthrift

This comment has been minimized.

Copy link
@kcudnik

kcudnik Mar 14, 2018

Collaborator

should all those libs be included in libsai.so and here should be not needed ? sincd libsai.so should be linked with those libraries before compiled syncd

else
SAILIB=-lsai
endif
endif

syncd_SOURCES = \
main.cpp \
Expand Down
11 changes: 10 additions & 1 deletion syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,17 @@ config_syncd_marvell()
[ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 )
}

config_syncd_barefoot()
{
export ONIE_PLATFORM=`grep platform /etc/machine.conf | awk 'BEGIN { FS = "=" } ; { print $2 }'`
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/bfn/install/lib/platform/$ONIE_PLATFORM:/opt/bfn/install/lib:/opt/bfn/install/lib/tofinopd/switch
. /opt/bfn/install/bin/dma_setup.sh
export LD_PRELOAD=libswitchapi.so:libswitchsai.so:libpd.so:libpdcli.so:libdriver.so:libbfsys.so
}

config_syncd_nephos()
{
CMD_ARGS+=" -p $HWSKU_DIR/sai.profile"

if [ $FAST_REBOOT == "yes" ]; then
CMD_ARGS+=" -t fast"
fi
Expand All @@ -122,6 +129,8 @@ config_syncd()
config_syncd_centec
elif [ "$SONIC_ASIC_TYPE" == "marvell" ]; then
config_syncd_marvell
elif [ "$SONIC_ASIC_TYPE" == "barefoot" ]; then
config_syncd_barefoot
elif [ "$SONIC_ASIC_TYPE" == "nephos" ]; then
config_syncd_nephos
else
Expand Down

0 comments on commit c591e38

Please sign in to comment.