Skip to content
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 fboss/agent/hw/sai/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ using facebook::fboss::DeltaFunctions::forEachRemoved;

namespace facebook { namespace fboss {

// Default service method table getters
static const char* saiProfileValueGet(sai_switch_profile_id_t profile_id,
const char* var_name)
{
return NULL;
}

static int saiProfileValueGetNext(sai_switch_profile_id_t profile_id,
const char** variable,
const char** value)
{
return -1;
}

// TODO: remove this when SAI callbacks support pointer to user data storage.
SaiSwitch* SaiSwitch::instance_ = nullptr;

Expand All @@ -98,6 +112,9 @@ SaiSwitch::SaiSwitch(SaiPlatformBase *platform)
, lockFd(-1) {
VLOG(4) << "Entering " << __FUNCTION__;

service_.profile_get_value = saiProfileValueGet;
service_.profile_get_next_value = saiProfileValueGetNext;

//sai_status_t status = sai_service_method_table_initialize(&service_);
//if (status != SAI_STATUS_SUCCESS) {
// throw SaiFatal("Failed to initialize service method table. Error: ", status);
Expand Down
80 changes: 80 additions & 0 deletions fboss/github/getdeps_SAI.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash

function update() {
repo=`basename $1 .git`
echo "updating $repo..."
if [ -d $repo ]; then
(cd $repo && git pull)
else
git clone $1
fi
[ -z "$2" ] || (cd $repo && git checkout $2)
}

function update_SAI() {
repo="SAI"
echo "updating $repo..."
if [ -d $repo ]; then
(cd $repo && git pull)
else
git clone https://github.com/opencomputeproject/SAI.git $repo
fi
(cd $repo && git checkout v0.9.3.0)
(cd $repo && mkdir -p lib)
(cd $repo && ln -s sai/inc inc)
}

function update_branch() {
branch="$1"
if [ "$(git symbolic-ref -q --short HEAD)" != "OpenNSL_6.3" ]; then
git checkout -tb "$branch" "origin/$branch"
fi
}

function build() {
(
echo "building $1..."
cd $1
if [ -e ./CMakeLists.txt ]; then
mkdir -p build
cd build
echo cmake .. $CMAKEFLAGS
cmake .. $CMAKEFLAGS
make
else
if [ ! -e ./configure ]; then
autoreconf --install
fi
./configure
make -j8
fi
)
}

echo "installing packages"
sudo apt-get install -yq autoconf automake libdouble-conversion-dev \
libssl-dev make zip git autoconf libtool g++ libboost-all-dev \
libevent-dev flex bison libgoogle-glog-dev scons libkrb5-dev \
libsnappy-dev libsasl2-dev libnuma-dev libi2c-dev libcurl4-nss-dev \
libusb-1.0-0-dev libpcap-dev libdb5.3-dev cmake

echo "creating external..."
mkdir -p external
(
cd external
# We hard code OpenNSL to OpenNSL-6.4.6.6 release, later releases seem to
# SIGSEV in opennsl_pkt_alloc()
update https://github.com/Broadcom-Switch/OpenNSL.git 8e0b499f02dcef751a3703c9a18600901374b28a
update \
git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git v3.19.0
update https://github.com/facebook/folly.git 08dba5714790020d2fa677e34e624eb4f34a20ca
update https://github.com/facebook/wangle.git d67b7632be2923de3695201c7ac361f50646bbbf
update https://github.com/facebook/fbthrift.git 1b2b03a472c41915a8c481a06edc630674377e77
update_SAI
build iproute2
build folly/folly
export CMAKEFLAGS=-D"FOLLY_INCLUDE_DIR=`pwd`/folly"\ -D"FOLLY_LIBRARY=`pwd`/folly/folly/.libs/libfolly.a"\ -D"BUILD_TESTS=OFF"
build wangle/wangle
export CPPFLAGS=" -I`pwd`/folly -I`pwd`/wangle" LDFLAGS="-L`pwd`/folly/folly/.libs/ -L`pwd`/wangle/wangle/build/lib"
build fbthrift/thrift
)