Skip to content

Commit

Permalink
Update Makefile to skip vpp if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Dec 17, 2024
1 parent aa04ead commit 14fc320
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
18 changes: 13 additions & 5 deletions vslib/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib -I/usr/include/libnl3 -Ivpp
AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib -I/usr/include/libnl3

if USE_VPP
AM_CXXFLAGS += -Ivpp -DUSE_VPP
endif

CFLAGS_COMMON= -fPIC -pipe -Wall -Wcast-align -Wcast-qual -Wconversion -Wdisabled-optimization -Werror -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Wno-inline -Winvalid-pch -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-aggregate-return -Wno-padded -Wno-switch-enum -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-aliasing=3 -Wswitch -Wswitch-default -Wunreachable-code -Wunused -Wvariadic-macros -Wwrite-strings -Wno-switch-default -Wconversion -Wno-psabi -Wcast-align=strict

Expand Down Expand Up @@ -79,6 +83,12 @@ libSaiVS_a_SOURCES = \
SwitchState.cpp \
TrafficFilterPipes.cpp \
TrafficForwarder.cpp \
VirtualSwitchSaiInterface.cpp \
VirtualSwitchSaiInterfaceFdb.cpp \
VirtualSwitchSaiInterfacePort.cpp

if USE_VPP
libSaiVS_a_SOURCES +=\
vpp/SaiObjectDB.cpp \
vpp/SwitchVpp.cpp \
vpp/SwitchVppAcl.cpp \
Expand All @@ -94,10 +104,8 @@ libSaiVS_a_SOURCES = \
vpp/vppxlate/SaiVppXlate.c \
vpp/vppxlate/SaiVppStats.c \
vpp/vppxlate/SaiAclStats.c \
vpp/vppxlate/SaiIntfStats.c \
VirtualSwitchSaiInterface.cpp \
VirtualSwitchSaiInterfaceFdb.cpp \
VirtualSwitchSaiInterfacePort.cpp
vpp/vppxlate/SaiIntfStats.c
endif

BUILT_SOURCES = sai_vs.cpp

Expand Down
7 changes: 7 additions & 0 deletions vslib/VirtualSwitchSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include "SwitchBCM56971B0.h"
#include "SwitchMLNX2700.h"
#include "SwitchNvdaMBF2H536C.h"
#ifdef USE_VPP
#include "SwitchVpp.h"
#endif

#include <inttypes.h>

Expand Down Expand Up @@ -604,8 +606,13 @@ std::shared_ptr<SwitchStateBase> VirtualSwitchSaiInterface::init_switch(

case SAI_VS_SWITCH_TYPE_VPP:

#ifdef USE_VPP
m_switchStateMap[switch_id] = std::make_shared<SwitchVpp>(switch_id, m_realObjectIdManager, config, warmBootState);
break;
#else
SWSS_LOG_WARN("vslib not compiled with vpp");
return nullptr;
#endif

default:

Expand Down
4 changes: 4 additions & 0 deletions vslib/VirtualSwitchSaiInterfaceFdb.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "VirtualSwitchSaiInterface.h"
#include "SwitchStateBase.h"
#ifdef USE_VPP
#include "SwitchVpp.h"
#endif

#include "meta/sai_serialize.h"

Expand Down Expand Up @@ -281,12 +283,14 @@ sai_status_t VirtualSwitchSaiInterface::flushFdbEntries(
data.fdb_entry.bv_id = vlanid->value.oid;
}

#ifdef USE_VPP
auto vpp = std::dynamic_pointer_cast<saivs::SwitchVpp>(ss);

if (vpp)
{
vpp->vpp_fdbentry_flush(switch_id, attr_count, attr_list);
}
#endif

if (static_fdbs.size())
{
Expand Down

0 comments on commit 14fc320

Please sign in to comment.