[BFN] syncd-rpc build with thrift 0.14.1 (#9884)
This commit is contained in:
parent
d540492834
commit
bec35267cb
@ -2,7 +2,7 @@
|
||||
|
||||
DOCKER_SYNCD_BFN_RPC = docker-syncd-bfn-rpc.gz
|
||||
$(DOCKER_SYNCD_BFN_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn-rpc
|
||||
$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF)
|
||||
$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT_0_14_1) $(PTF)
|
||||
$(DOCKER_SYNCD_BFN_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
ifeq ($(INSTALL_DEBUG_TOOLS), y)
|
||||
$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \
|
||||
|
@ -1,18 +1,28 @@
|
||||
SAITHRIFT_PATCHES = saithrift-patches
|
||||
$(SAITHRIFT_PATCHES)_SRC_PATH = $(PLATFORM_PATH)/saithrift-patches
|
||||
SONIC_MAKE_FILES += $(SAITHRIFT_PATCHES)
|
||||
|
||||
# libsaithrift-dev package
|
||||
|
||||
SAI_VER = 0.9.4
|
||||
|
||||
LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb
|
||||
LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb
|
||||
$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
|
||||
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV)
|
||||
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI)
|
||||
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) \
|
||||
$(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) \
|
||||
$(BFN_SAI)
|
||||
|
||||
#$(LIBSAIVS) $(LIBSAIVS_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV)
|
||||
|
||||
# $(LIBSAITHRIFT_DEV)_BUILD_ENV = platform=v
|
||||
$(LIBSAITHRIFT_DEV)_AFTER_FILES = $(SAITHRIFT_PATCHES)
|
||||
|
||||
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI)
|
||||
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV)
|
||||
|
||||
PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb
|
||||
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT)))
|
||||
|
||||
SAISERVER = saiserver_$(SAI_VER)_amd64.deb
|
||||
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
|
||||
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI)
|
||||
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER)))
|
||||
|
||||
SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb
|
||||
|
@ -24,7 +24,8 @@ $(SYNCD)_DEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM)
|
||||
$(SYNCD)_UNINSTALLS += $(BFN_SAI)
|
||||
|
||||
ifeq ($(ENABLE_SYNCD_RPC),y)
|
||||
$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV)
|
||||
$(SYNCD)_DEPENDS := $(filter-out $(LIBTHRIFT_DEV),$($(SYNCD)_DEPENDS))
|
||||
$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) $(LIBTHRIFT_0_14_1_DEV)
|
||||
endif
|
||||
|
||||
# Runtime dependency on sai is set only for syncd
|
||||
|
@ -0,0 +1,70 @@
|
||||
From 6f0188ad82845ac56729d3db621b2d10bea94ddd Mon Sep 17 00:00:00 2001
|
||||
From: Myron Sosyak <myronx.sosyak@intel.com>
|
||||
Date: Thu, 27 Jan 2022 17:25:42 +0000
|
||||
Subject: [PATCH 1/4] Replace unions with structs in thrift
|
||||
|
||||
---
|
||||
test/saithrift/src/switch_sai.thrift | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/test/saithrift/src/switch_sai.thrift b/test/saithrift/src/switch_sai.thrift
|
||||
index a9e1d28..0c24b71 100644
|
||||
--- a/test/saithrift/src/switch_sai.thrift
|
||||
+++ b/test/saithrift/src/switch_sai.thrift
|
||||
@@ -48,7 +48,7 @@ struct sai_thrift_vlan_port_t {
|
||||
2: sai_thrift_vlan_tagging_mode_t tagging_mode;
|
||||
}
|
||||
|
||||
-union sai_thrift_ip_t {
|
||||
+struct sai_thrift_ip_t {
|
||||
1: sai_thrift_ip4_t ip4;
|
||||
2: sai_thrift_ip6_t ip6;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ struct sai_thrift_s32_list_t {
|
||||
2: list<i32> s32list;
|
||||
}
|
||||
|
||||
-union sai_thrift_acl_mask_t {
|
||||
+struct sai_thrift_acl_mask_t {
|
||||
1: byte u8;
|
||||
2: byte s8;
|
||||
3: i16 u16;
|
||||
@@ -91,7 +91,7 @@ union sai_thrift_acl_mask_t {
|
||||
9: sai_thrift_ip6_t ip6;
|
||||
}
|
||||
|
||||
-union sai_thrift_acl_data_t {
|
||||
+struct sai_thrift_acl_data_t {
|
||||
1: byte u8;
|
||||
2: byte s8;
|
||||
3: i16 u16;
|
||||
@@ -112,7 +112,7 @@ struct sai_thrift_acl_field_data_t
|
||||
3: sai_thrift_acl_data_t data;
|
||||
}
|
||||
|
||||
-union sai_thrift_acl_parameter_t {
|
||||
+struct sai_thrift_acl_parameter_t {
|
||||
1: byte u8;
|
||||
2: byte s8;
|
||||
3: i16 u16;
|
||||
@@ -161,7 +161,7 @@ struct sai_thrift_fdb_values_t {
|
||||
2: sai_thrift_fdb_entry_t thrift_fdb_entry;
|
||||
}
|
||||
|
||||
-union sai_thrift_attribute_value_t {
|
||||
+struct sai_thrift_attribute_value_t {
|
||||
1: bool booldata;
|
||||
2: string chardata;
|
||||
3: byte u8;
|
||||
@@ -207,7 +207,7 @@ struct sai_thrift_attribute_list_t {
|
||||
2: i32 attr_count; // redundant
|
||||
}
|
||||
|
||||
-union sai_thrift_result_data_t {
|
||||
+struct sai_thrift_result_data_t {
|
||||
1: sai_thrift_object_list_t objlist;
|
||||
2: sai_thrift_object_id_t oid;
|
||||
3: i16 u16;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 6605dbe4906173b78f428f42f749674c2722361a Mon Sep 17 00:00:00 2001
|
||||
From: Myron Sosyak <myronx.sosyak@intel.com>
|
||||
Date: Thu, 27 Jan 2022 17:26:08 +0000
|
||||
Subject: [PATCH 2/4] Use std::shared_ptr instead of boost
|
||||
|
||||
---
|
||||
test/saithrift/src/switch_sai_rpc_server.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/saithrift/src/switch_sai_rpc_server.cpp b/test/saithrift/src/switch_sai_rpc_server.cpp
|
||||
index 0df9b3d..e990c50 100644
|
||||
--- a/test/saithrift/src/switch_sai_rpc_server.cpp
|
||||
+++ b/test/saithrift/src/switch_sai_rpc_server.cpp
|
||||
@@ -74,7 +74,7 @@ using namespace ::apache::thrift::protocol;
|
||||
using namespace ::apache::thrift::transport;
|
||||
using namespace ::apache::thrift::server;
|
||||
|
||||
-using boost::shared_ptr;
|
||||
+using std::shared_ptr;
|
||||
|
||||
using namespace ::switch_sai;
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,24 @@
|
||||
From b468a7aa00843be9c5ead478bd074784c04b4ba2 Mon Sep 17 00:00:00 2001
|
||||
From: Myron Sosyak <myronx.sosyak@intel.com>
|
||||
Date: Thu, 27 Jan 2022 17:26:40 +0000
|
||||
Subject: [PATCH 3/4] include algorithm
|
||||
|
||||
---
|
||||
test/saithrift/src/saiserver.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/test/saithrift/src/saiserver.cpp b/test/saithrift/src/saiserver.cpp
|
||||
index 846c3f1..7120b26 100644
|
||||
--- a/test/saithrift/src/saiserver.cpp
|
||||
+++ b/test/saithrift/src/saiserver.cpp
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
+#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 58d5e21378d3fd5dd3a48adb24423c1bb9ff6f7a Mon Sep 17 00:00:00 2001
|
||||
From: Myron Sosyak <myronx.sosyak@intel.com>
|
||||
Date: Thu, 27 Jan 2022 17:28:05 +0000
|
||||
Subject: [PATCH 4/4] Fix Thrift 0.14.1 compatibility
|
||||
|
||||
---
|
||||
test/saithrift/Makefile | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/test/saithrift/Makefile b/test/saithrift/Makefile
|
||||
index cbe6f48..3734ee7 100644
|
||||
--- a/test/saithrift/Makefile
|
||||
+++ b/test/saithrift/Makefile
|
||||
@@ -21,8 +21,8 @@ CDEFS = -DBRCMSAI
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
-DEPS = switch_sai_constants.h switch_sai_rpc.h switch_sai_types.h
|
||||
-OBJS = switch_sai_constants.o switch_sai_rpc.o switch_sai_types.o
|
||||
+DEPS = switch_sai_rpc.h switch_sai_types.h
|
||||
+OBJS = switch_sai_rpc.o switch_sai_types.o
|
||||
|
||||
ODIR = ./src/obj
|
||||
SAIDIR = ./include
|
||||
@@ -42,8 +42,6 @@ endif
|
||||
SAI_LIBRARY_DIR ?= $(SAI_PREFIX)/lib
|
||||
LDFLAGS = -L$(SAI_LIBRARY_DIR) -Wl,-rpath=$(SAI_LIBRARY_DIR)
|
||||
CPP_SOURCES = \
|
||||
- src/gen-cpp/switch_sai_constants.cpp \
|
||||
- src/gen-cpp/switch_sai_constants.h \
|
||||
src/gen-cpp/switch_sai_rpc.cpp \
|
||||
src/gen-cpp/switch_sai_rpc.h \
|
||||
src/gen-cpp/switch_sai_types.cpp \
|
||||
@@ -89,8 +87,8 @@ $(ODIR)/switch_sai_rpc_server.o: src/switch_sai_rpc_server.cpp
|
||||
$(ODIR)/saiserver.o: src/saiserver.cpp
|
||||
$(CXX) $(CFLAGS) -c $^ -o $@ $(CFLAGS) $(CDEFS) -I$(SRC)/gen-cpp -I$(SRC)
|
||||
|
||||
-$(ODIR)/librpcserver.a: $(ODIR)/switch_sai_rpc.o $(ODIR)/switch_sai_types.o $(ODIR)/switch_sai_constants.o $(ODIR)/switch_sai_rpc_server.o
|
||||
- ar rcs $(ODIR)/librpcserver.a $(ODIR)/switch_sai_rpc.o $(ODIR)/switch_sai_types.o $(ODIR)/switch_sai_constants.o $(ODIR)/switch_sai_rpc_server.o
|
||||
+$(ODIR)/librpcserver.a: $(ODIR)/switch_sai_rpc.o $(ODIR)/switch_sai_types.o $(ODIR)/switch_sai_rpc_server.o
|
||||
+ ar rcs $(ODIR)/librpcserver.a $(ODIR)/switch_sai_rpc.o $(ODIR)/switch_sai_types.o $(ODIR)/switch_sai_rpc_server.o
|
||||
|
||||
saiserver: $(ODIR)/saiserver.o $(ODIR)/librpcserver.a
|
||||
$(CXX) $(LDFLAGS) $(ODIR)/switch_sai_rpc_server.o $(ODIR)/saiserver.o -o $@ \
|
||||
--
|
||||
2.20.1
|
||||
|
19
platform/barefoot/saithrift-patches/Makefile
Normal file
19
platform/barefoot/saithrift-patches/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
SHELL = /bin/bash
|
||||
.ONESHELL:
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = saithrift-patches
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# To add some BFN specific patches to SAI under sonic-sairedis while sai is not updated
|
||||
SRC_DIR = ../saithrift-patches
|
||||
DST_DIR = ../../../src/sonic-sairedis/SAI.patch/
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# copy patches to SAI
|
||||
mkdir -p $(DST_DIR)
|
||||
cp -f $(SRC_DIR)/* $(DST_DIR)
|
||||
|
||||
touch $(DEST)/saithrift-patches
|
||||
|
||||
|
4
platform/barefoot/saithrift-patches/series
Normal file
4
platform/barefoot/saithrift-patches/series
Normal file
@ -0,0 +1,4 @@
|
||||
0001-Replace-unions-with-structs-in-thrift.patch
|
||||
0002-Use-std-shared_ptr-instead-of-boost.patch
|
||||
0003-include-algorithm.patch
|
||||
0004-Fix-Thrift-0.14.1-compatibility.patch
|
1
slave.mk
1
slave.mk
@ -521,6 +521,7 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS))
|
||||
# SONIC_DPKG_DEBS += $(SOME_NEW_DEB)
|
||||
$(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \
|
||||
$$(addprefix $(DEBS_PATH)/,$$($$*_AFTER)) \
|
||||
$$(addprefix $(FILES_PATH)/,$$($$*_AFTER_FILES)) \
|
||||
$(call dpkg_depend,$(DEBS_PATH)/%.dep )
|
||||
$(HEADER)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user