Skip to content

Commit d2601d9

Browse files
authored
Merge pull request sonic-net#264 from lguohan/v1.2
update sairedis/syncd to use SAI v1.2.3
2 parents 077af8f + bda2a57 commit d2601d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+720
-491
lines changed

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
path = SAI
33
url = https://github.com/opencomputeproject/SAI.git
44
ignore = dirty
5+
branch = v1.2

SAI

Submodule SAI updated 95 files

lib/inc/sai_redis.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extern volatile bool g_useTempView;
6161
extern volatile bool g_asicInitViewMode;
6262
extern volatile bool g_logrotate;
6363

64-
extern service_method_table_t g_services;
64+
extern sai_service_method_table_t g_services;
6565
extern std::shared_ptr<swss::ProducerTable> g_asicState;
6666
extern std::shared_ptr<swss::ConsumerTable> g_redisGetConsumer;
6767
extern std::shared_ptr<swss::NotificationConsumer> g_redisNotifications;

lib/inc/sairedis.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ typedef enum _sai_redis_switch_attr_t
133133
* @param[in] attr_count List of attr_count. Caller passes the number
134134
* of attribute for each object to create.
135135
* @param[in] attr_list List of attributes for every object.
136-
* @param[in] type Bulk operation type.
136+
* @param[in] mode Bulk operation error handling mode
137137
* @param[out] object_statuses List of status for every object. Caller needs to
138138
* allocate the buffer
139139
*
@@ -147,15 +147,15 @@ sai_status_t sai_bulk_create_route_entry(
147147
_In_ const sai_route_entry_t *route_entry,
148148
_In_ const uint32_t *attr_count,
149149
_In_ const sai_attribute_t *const *attr_list,
150-
_In_ sai_bulk_op_type_t type,
150+
_In_ sai_bulk_op_error_mode_t mode,
151151
_Out_ sai_status_t *object_statuses);
152152

153153
/**
154154
* @brief Bulk remove route entry
155155
*
156156
* @param[in] object_count Number of objects to remove
157157
* @param[in] route_entry List of objects to remove
158-
* @param[in] type Bulk operation type.
158+
* @param[in] mode Bulk operation error handling mode
159159
* @param[out] object_statuses List of status for every object. Caller needs to
160160
* allocate the buffer
161161
*
@@ -167,7 +167,7 @@ sai_status_t sai_bulk_create_route_entry(
167167
sai_status_t sai_bulk_remove_route_entry(
168168
_In_ uint32_t object_count,
169169
_In_ const sai_route_entry_t *route_entry,
170-
_In_ sai_bulk_op_type_t type,
170+
_In_ sai_bulk_op_error_mode_t mode,
171171
_Out_ sai_status_t *object_statuses);
172172

173173
/**
@@ -176,7 +176,7 @@ sai_status_t sai_bulk_remove_route_entry(
176176
* @param[in] object_count Number of objects to set attribute
177177
* @param[in] route_entry List of objects to set attribute
178178
* @param[in] attr_list List of attributes to set on objects, one attribute per object
179-
* @param[in] type Bulk operation type.
179+
* @param[in] mode Bulk operation error handling mode
180180
* @param[out] object_statuses List of status for every object. Caller needs to
181181
* allocate the buffer
182182
*
@@ -189,7 +189,7 @@ sai_status_t sai_bulk_set_route_entry_attribute(
189189
_In_ uint32_t object_count,
190190
_In_ const sai_route_entry_t *route_entry,
191191
_In_ const sai_attribute_t *attr_list,
192-
_In_ sai_bulk_op_type_t type,
192+
_In_ sai_bulk_op_error_mode_t mode,
193193
_Out_ sai_status_t *object_statuses);
194194

195195
/**
@@ -200,7 +200,7 @@ sai_status_t sai_bulk_set_route_entry_attribute(
200200
* @param[in] attr_count List of attr_count. Caller passes the number
201201
* of attribute for each object to get
202202
* @param[inout] attr_list List of attributes to set on objects, one attribute per object
203-
* @param[in] type Bulk operation type
203+
* @param[in] mode Bulk operation error handling mode
204204
* @param[out] object_statuses List of status for every object. Caller needs to
205205
* allocate the buffer
206206
*
@@ -214,35 +214,35 @@ sai_status_t sai_bulk_get_route_entry_attribute(
214214
_In_ const sai_route_entry_t *route_entry,
215215
_In_ const uint32_t *attr_count,
216216
_Inout_ sai_attribute_t **attr_list,
217-
_In_ sai_bulk_op_type_t type,
217+
_In_ sai_bulk_op_error_mode_t mode,
218218
_Out_ sai_status_t *object_statuses);
219219

220220
sai_status_t sai_bulk_create_next_hop_group_members(
221221
_In_ sai_object_id_t switch_id,
222222
_In_ uint32_t object_count,
223223
_In_ const uint32_t *attr_count,
224224
_In_ const sai_attribute_t *const *attrs,
225-
_In_ sai_bulk_op_type_t type,
225+
_In_ sai_bulk_op_error_mode_t mode,
226226
_Out_ sai_object_id_t *object_id,
227227
_Out_ sai_status_t *object_statuses);
228228

229229
sai_status_t sai_bulk_remove_next_hop_group_members(
230230
_In_ uint32_t object_count,
231231
_In_ const sai_object_id_t *object_id,
232-
_In_ sai_bulk_op_type_t type,
232+
_In_ sai_bulk_op_error_mode_t mode,
233233
_Out_ sai_status_t *object_statuses);
234234

235235
sai_status_t sai_bulk_create_fdb_entry(
236236
_In_ uint32_t object_count,
237237
_In_ const sai_fdb_entry_t *fdb_entry,
238238
_In_ const uint32_t *attr_count,
239239
_In_ const sai_attribute_t *const *attr_list,
240-
_In_ sai_bulk_op_type_t type,
240+
_In_ sai_bulk_op_error_mode_t mode,
241241
_Out_ sai_status_t *object_statuses);
242242

243243
sai_status_t sai_bulk_remove_fdb_entry(
244244
_In_ uint32_t object_count,
245245
_In_ const sai_fdb_entry_t *fdb_entry,
246-
_In_ sai_bulk_op_type_t type,
246+
_In_ sai_bulk_op_error_mode_t mode,
247247
_Out_ sai_status_t *object_statuses);
248248
#endif // __SAIREDIS__

lib/src/sai_redis_bridge.cpp

+57
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,67 @@
11
#include "sai_redis.h"
22

3+
sai_status_t redis_get_bridge_stats(
4+
_In_ sai_object_id_t bridge_id,
5+
_In_ uint32_t number_of_counters,
6+
_In_ const sai_bridge_stat_t *counter_ids,
7+
_Out_ uint64_t *counters)
8+
{
9+
MUTEX();
10+
11+
SWSS_LOG_ENTER();
12+
13+
return SAI_STATUS_NOT_IMPLEMENTED;
14+
}
15+
16+
sai_status_t redis_clear_bridge_stats(
17+
_In_ sai_object_id_t bridge_id,
18+
_In_ uint32_t number_of_counters,
19+
_In_ const sai_bridge_stat_t *counter_ids)
20+
{
21+
MUTEX();
22+
23+
SWSS_LOG_ENTER();
24+
25+
return SAI_STATUS_NOT_IMPLEMENTED;
26+
}
27+
28+
sai_status_t redis_get_bridge_port_stats(
29+
_In_ sai_object_id_t bridge_port_id,
30+
_In_ uint32_t number_of_counters,
31+
_In_ const sai_bridge_port_stat_t *counter_ids,
32+
_Out_ uint64_t *counters)
33+
{
34+
MUTEX();
35+
36+
SWSS_LOG_ENTER();
37+
38+
return SAI_STATUS_NOT_IMPLEMENTED;
39+
}
40+
41+
sai_status_t redis_clear_bridge_port_stats(
42+
_In_ sai_object_id_t bridge_port_id,
43+
_In_ uint32_t number_of_counters,
44+
_In_ const sai_bridge_port_stat_t *counter_ids)
45+
{
46+
MUTEX();
47+
48+
SWSS_LOG_ENTER();
49+
50+
return SAI_STATUS_NOT_IMPLEMENTED;
51+
}
52+
353
REDIS_GENERIC_QUAD(BRIDGE,bridge);
454
REDIS_GENERIC_QUAD(BRIDGE_PORT,bridge_port);
555

656
const sai_bridge_api_t redis_bridge_api =
757
{
858
REDIS_GENERIC_QUAD_API(bridge)
59+
60+
redis_get_bridge_stats,
61+
redis_clear_bridge_stats,
62+
963
REDIS_GENERIC_QUAD_API(bridge_port)
64+
65+
redis_get_bridge_port_stats,
66+
redis_clear_bridge_port_stats,
1067
};

lib/src/sai_redis_fdb.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
sai_status_t internal_redis_flush_fdb_entries(
@@ -144,7 +144,7 @@ sai_status_t sai_bulk_create_fdb_entry(
144144
_In_ const sai_fdb_entry_t *fdb_entry,
145145
_In_ const uint32_t *attr_count,
146146
_In_ const sai_attribute_t *const *attr_list,
147-
_In_ sai_bulk_op_type_t type,
147+
_In_ sai_bulk_op_error_mode_t mode,
148148
_Out_ sai_status_t *object_statuses)
149149
{
150150
std::lock_guard<std::mutex> lock(g_apimutex);
@@ -179,16 +179,16 @@ sai_status_t sai_bulk_create_fdb_entry(
179179
return SAI_STATUS_INVALID_PARAMETER;
180180
}
181181

182-
switch (type)
182+
switch (mode)
183183
{
184-
case SAI_BULK_OP_TYPE_STOP_ON_ERROR:
185-
case SAI_BULK_OP_TYPE_INGORE_ERROR:
184+
case SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR:
185+
case SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR:
186186
// ok
187187
break;
188188

189189
default:
190190

191-
SWSS_LOG_ERROR("invalid bulk operation type %d", type);
191+
SWSS_LOG_ERROR("invalid bulk operation mode %d", mode);
192192

193193
return SAI_STATUS_INVALID_PARAMETER;
194194
}
@@ -233,7 +233,7 @@ sai_status_t sai_bulk_create_fdb_entry(
233233
idx,
234234
serialized_object_ids[idx].c_str());
235235

236-
if (type == SAI_BULK_OP_TYPE_STOP_ON_ERROR)
236+
if (mode == SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR)
237237
{
238238
SWSS_LOG_NOTICE("stop on error since previous operation failed");
239239
break;
@@ -256,7 +256,7 @@ sai_status_t sai_bulk_create_fdb_entry(
256256
sai_status_t sai_bulk_remove_fdb_entry(
257257
_In_ uint32_t object_count,
258258
_In_ const sai_fdb_entry_t *fdb_entry,
259-
_In_ sai_bulk_op_type_t type,
259+
_In_ sai_bulk_op_error_mode_t mode,
260260
_Out_ sai_status_t *object_statuses)
261261
{
262262
std::lock_guard<std::mutex> lock(g_apimutex);

lib/src/sai_redis_generic_create.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
bool switch_ids[MAX_SWITCHES] = {};

lib/src/sai_redis_generic_get.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
sai_status_t internal_redis_get_process(

lib/src/sai_redis_generic_get_stats.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33

44
sai_status_t internal_redis_get_stats_process(
55
_In_ sai_object_type_t object_type,
@@ -54,6 +54,13 @@ struct stat_traits<sai_port_stat_t>
5454
static constexpr serialize_stat serialize_stat_fn = sai_serialize_port_stat;
5555
};
5656

57+
template <>
58+
struct stat_traits<sai_port_pool_stat_t>
59+
{
60+
typedef std::string (*serialize_stat)(sai_port_pool_stat_t);
61+
static constexpr serialize_stat serialize_stat_fn = sai_serialize_port_pool_stat;
62+
};
63+
5764
template <>
5865
struct stat_traits<sai_queue_stat_t>
5966
{
@@ -68,6 +75,13 @@ struct stat_traits<sai_ingress_priority_group_stat_t>
6875
static constexpr serialize_stat serialize_stat_fn = sai_serialize_ingress_priority_group_stat;
6976
};
7077

78+
template <>
79+
struct stat_traits<sai_tunnel_stat_t>
80+
{
81+
typedef std::string (*serialize_stat)(sai_tunnel_stat_t);
82+
static constexpr serialize_stat serialize_stat_fn = sai_serialize_tunnel_stat;
83+
};
84+
7185

7286
template <class T>
7387
std::vector<swss::FieldValueTuple> serialize_counter_id_list(
@@ -213,5 +227,7 @@ sai_status_t redis_generic_get_stats(
213227
_Out_ uint64_t *counter_list); \
214228

215229
DECLARE_REDIS_GENERIC_GET_STATS(port);
230+
DECLARE_REDIS_GENERIC_GET_STATS(port_pool);
216231
DECLARE_REDIS_GENERIC_GET_STATS(queue);
217232
DECLARE_REDIS_GENERIC_GET_STATS(ingress_priority_group);
233+
DECLARE_REDIS_GENERIC_GET_STATS(tunnel);

lib/src/sai_redis_generic_remove.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
sai_status_t internal_redis_generic_remove(

lib/src/sai_redis_generic_set.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
sai_status_t internal_redis_generic_set(

lib/src/sai_redis_interfacequery.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
std::mutex g_apimutex;
88

9-
service_method_table_t g_services;
9+
sai_service_method_table_t g_services;
1010
bool g_apiInitialized = false;
1111
volatile bool g_run = false;
1212

@@ -95,7 +95,7 @@ void ntf_thread()
9595

9696
sai_status_t sai_api_initialize(
9797
_In_ uint64_t flags,
98-
_In_ const service_method_table_t* services)
98+
_In_ const sai_service_method_table_t* services)
9999
{
100100
std::lock_guard<std::mutex> lock(g_apimutex);
101101

lib/src/sai_redis_lag.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sai_status_t redis_bulk_object_create_lag(
55
_In_ uint32_t object_count,
66
_In_ const uint32_t *attr_count,
77
_In_ const sai_attribute_t **attrs,
8-
_In_ sai_bulk_op_type_t type,
8+
_In_ sai_bulk_op_error_mode_t mode,
99
_Out_ sai_object_id_t *object_id,
1010
_Out_ sai_status_t *object_statuses)
1111
{
@@ -19,7 +19,7 @@ sai_status_t redis_bulk_object_create_lag(
1919
sai_status_t redis_bulk_object_remove_lag(
2020
_In_ uint32_t object_count,
2121
_In_ const sai_object_id_t *object_id,
22-
_In_ sai_bulk_op_type_t type,
22+
_In_ sai_bulk_op_error_mode_t mode,
2323
_Out_ sai_status_t *object_statuses)
2424
{
2525
MUTEX();

lib/src/sai_redis_nexthopgroup.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sai_status_t sai_bulk_create_next_hop_group_members(
55
_In_ uint32_t object_count,
66
_In_ const uint32_t *attr_count,
77
_In_ const sai_attribute_t *const *attrs,
8-
_In_ sai_bulk_op_type_t type,
8+
_In_ sai_bulk_op_error_mode_t mode,
99
_Out_ sai_object_id_t *object_id,
1010
_Out_ sai_status_t *object_statuses)
1111
{
@@ -20,7 +20,7 @@ sai_status_t sai_bulk_create_next_hop_group_members(
2020
sai_status_t sai_bulk_remove_next_hop_group_members(
2121
_In_ uint32_t object_count,
2222
_In_ const sai_object_id_t *object_id,
23-
_In_ sai_bulk_op_type_t type,
23+
_In_ sai_bulk_op_error_mode_t mode,
2424
_Out_ sai_status_t *object_statuses)
2525
{
2626
MUTEX();

lib/src/sai_redis_notifications.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "sai_redis.h"
2-
#include "meta/saiserialize.h"
2+
#include "meta/sai_serialize.h"
33
#include "meta/saiattributelist.h"
44

55
/*

0 commit comments

Comments
 (0)