forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BFN] syncd-rpc build with thrift 0.14.1 (sonic-net#9884)
- Loading branch information
Myron Sosyak
authored
Feb 18, 2022
1 parent
d540492
commit bec3526
Showing
10 changed files
with
209 additions
and
8 deletions.
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
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
70 changes: 70 additions & 0 deletions
70
platform/barefoot/saithrift-patches/0001-Replace-unions-with-structs-in-thrift.patch
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,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 | ||
|
25 changes: 25 additions & 0 deletions
25
platform/barefoot/saithrift-patches/0002-Use-std-shared_ptr-instead-of-boost.patch
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,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 | ||
|
24 changes: 24 additions & 0 deletions
24
platform/barefoot/saithrift-patches/0003-include-algorithm.patch
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,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 | ||
|
47 changes: 47 additions & 0 deletions
47
platform/barefoot/saithrift-patches/0004-Fix-Thrift-0.14.1-compatibility.patch
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,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 | ||
|
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,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 | ||
|
||
|
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,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 |
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