Skip to content

Commit 1b6fc2e

Browse files
[syncd] Add supports of bulk api in syncd (sonic-net#656)
1 parent a9f69c1 commit 1b6fc2e

16 files changed

+1273
-38
lines changed

saiplayer/SaiPlayer.cpp

+419-16
Large diffs are not rendered by default.

saiplayer/SaiPlayer.h

+14
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ namespace saiplayer
5252
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
5353
_In_ const std::vector<sai_status_t> &recorded_statuses);
5454

55+
sai_status_t handle_bulk_object(
56+
_In_ sai_object_type_t object_type,
57+
_In_ const std::vector<std::string> &object_ids,
58+
_In_ sai_common_api_t api,
59+
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
60+
_Out_ std::vector<sai_status_t> &statuses);
61+
62+
sai_status_t handle_bulk_entry(
63+
_In_ const std::vector<std::string> &object_ids,
64+
_In_ sai_object_type_t object_type,
65+
_In_ sai_common_api_t api,
66+
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
67+
_Out_ std::vector<sai_status_t> &statuses);
68+
5569
std::vector<std::string> tokenize(
5670
_In_ std::string input,
5771
_In_ const std::string &delim);

syncd/CommandLineOptions.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CommandLineOptions::CommandLineOptions()
1818
m_enableUnittests = false;
1919
m_enableConsistencyCheck = false;
2020
m_enableSyncMode = false;
21+
m_enableSaiBulkSupport = false;
2122

2223
m_startType = SAI_START_TYPE_COLD_BOOT;
2324

@@ -51,6 +52,7 @@ std::string CommandLineOptions::getCommandLineString() const
5152
ss << " EnableUnittests=" << (m_enableUnittests ? "YES" : "NO");
5253
ss << " EnableConsistencyCheck=" << (m_enableConsistencyCheck ? "YES" : "NO");
5354
ss << " EnableSyncMode=" << (m_enableSyncMode ? "YES" : "NO");
55+
ss << " EnableSaiBulkSuport=" << (m_enableSaiBulkSupport ? "YES" : "NO");
5456
ss << " StartType=" << startTypeToString(m_startType);
5557
ss << " ProfileMapFile=" << m_profileMapFile;
5658
ss << " GlobalContext=" << m_globalContext;

syncd/CommandLineOptions.h

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ namespace syncd
6868

6969
bool m_enableSyncMode;
7070

71+
bool m_enableSaiBulkSupport;
72+
7173
sai_start_type_t m_startType;
7274

7375
std::string m_profileMapFile;

syncd/CommandLineOptionsParser.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
1717
auto options = std::make_shared<CommandLineOptions>();
1818

1919
#ifdef SAITHRIFT
20-
const char* const optstring = "dp:t:g:x:b:uSUCsrm:h";
20+
const char* const optstring = "dp:t:g:x:b:uSUCslrm:h";
2121
#else
22-
const char* const optstring = "dp:t:g:x:b:uSUCsh";
22+
const char* const optstring = "dp:t:g:x:b:uSUCslh";
2323
#endif // SAITHRIFT
2424

2525
while(true)
@@ -34,6 +34,7 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
3434
{ "enableUnittests", no_argument, 0, 'U' },
3535
{ "enableConsistencyCheck", no_argument, 0, 'C' },
3636
{ "syncMode", no_argument, 0, 's' },
37+
{ "enableSaiBulkSupport", no_argument, 0, 'l' },
3738
{ "globalContext", required_argument, 0, 'g' },
3839
{ "contextContig", required_argument, 0, 'x' },
3940
{ "breakConfig", required_argument, 0, 'b' },
@@ -94,6 +95,10 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
9495
options->m_enableSyncMode = true;
9596
break;
9697

98+
case 'l':
99+
options->m_enableSaiBulkSupport = true;
100+
break;
101+
97102
case 'g':
98103
options->m_globalContext = (uint32_t)std::stoul(optarg);
99104
break;
@@ -138,9 +143,9 @@ void CommandLineOptionsParser::printUsage()
138143
SWSS_LOG_ENTER();
139144

140145
#ifdef SAITHRIFT
141-
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-g idx] [-x contextConfig] [-b breakConfig] [-r] [-m portmap] [-h]" << std::endl;
146+
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-l] [-g idx] [-x contextConfig] [-b breakConfig] [-r] [-m portmap] [-h]" << std::endl;
142147
#else
143-
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-g idx] [-x contextConfig] [-b breakConfig] [-h]" << std::endl;
148+
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-l] [-g idx] [-x contextConfig] [-b breakConfig] [-h]" << std::endl;
144149
#endif // SAITHRIFT
145150

146151
std::cout << " -d --diag" << std::endl;
@@ -159,6 +164,8 @@ void CommandLineOptionsParser::printUsage()
159164
std::cout << " Enable consisteny check DB vs ASIC after comparison logic" << std::endl;
160165
std::cout << " -s --syncMode" << std::endl;
161166
std::cout << " Enable synchronous mode" << std::endl;
167+
std::cout << " -l --enableBulk" << std::endl;
168+
std::cout << " Enable SAI Bulk support" << std::endl;
162169
std::cout << " -g --globalContext" << std::endl;
163170
std::cout << " Global context index to load from context config file" << std::endl;
164171
std::cout << " -x --contextConfig" << std::endl;

0 commit comments

Comments
 (0)