Skip to content

Commit

Permalink
Update SAI pointer to latest master (sonic-net#408)
Browse files Browse the repository at this point in the history
* Update SAI pointer to latest master

Signed-off-by: Marian Pritsak <marianp@mellanox.com>

* Use SAI_EXTENSIONS_TYPE_MAX

Signed-off-by: Marian Pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak authored and lguohan committed Jan 18, 2019
1 parent b1b739b commit 8793562
Show file tree
Hide file tree
Showing 24 changed files with 102 additions and 166 deletions.
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 330 files
110 changes: 55 additions & 55 deletions lib/inc/sai_redis_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,64 @@

// object id

#define REDIS_CREATE(OBJECT_TYPE,object_type) \
sai_status_t redis_create_ ## object_type( \
_Out_ sai_object_id_t *object_type ##_id, \
_In_ sai_object_id_t switch_id, \
_In_ uint32_t attr_count, \
_In_ const sai_attribute_t *attr_list) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_create_oid( \
SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
switch_id, \
attr_count, \
attr_list, \
&redis_generic_create); \
#define REDIS_CREATE(OBJECT_TYPE,object_type) \
sai_status_t redis_create_ ## object_type( \
_Out_ sai_object_id_t *object_type ##_id, \
_In_ sai_object_id_t switch_id, \
_In_ uint32_t attr_count, \
_In_ const sai_attribute_t *attr_list) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_create_oid( \
(sai_object_type_t)SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
switch_id, \
attr_count, \
attr_list, \
&redis_generic_create); \
}

#define REDIS_REMOVE(OBJECT_TYPE,object_type) \
sai_status_t redis_remove_ ## object_type( \
_In_ sai_object_id_t object_type ## _id) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_remove_oid( \
SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
&redis_generic_remove); \
#define REDIS_REMOVE(OBJECT_TYPE,object_type) \
sai_status_t redis_remove_ ## object_type( \
_In_ sai_object_id_t object_type ## _id) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_remove_oid( \
(sai_object_type_t)SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
&redis_generic_remove); \
}

#define REDIS_SET(OBJECT_TYPE,object_type) \
sai_status_t redis_set_ ##object_type ## _attribute(\
_In_ sai_object_id_t object_type ## _id, \
_In_ const sai_attribute_t *attr) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_set_oid( \
SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
attr, \
&redis_generic_set); \
#define REDIS_SET(OBJECT_TYPE,object_type) \
sai_status_t redis_set_ ##object_type ## _attribute( \
_In_ sai_object_id_t object_type ## _id, \
_In_ const sai_attribute_t *attr) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_set_oid( \
(sai_object_type_t)SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
attr, \
&redis_generic_set); \
}

#define REDIS_GET(OBJECT_TYPE,object_type) \
sai_status_t redis_get_ ##object_type ## _attribute(\
_In_ sai_object_id_t object_type ## _id, \
_In_ uint32_t attr_count, \
_Inout_ sai_attribute_t *attr_list) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_get_oid( \
SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
attr_count, \
attr_list, \
&redis_generic_get); \
#define REDIS_GET(OBJECT_TYPE,object_type) \
sai_status_t redis_get_ ##object_type ## _attribute( \
_In_ sai_object_id_t object_type ## _id, \
_In_ uint32_t attr_count, \
_Inout_ sai_attribute_t *attr_list) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
return meta_sai_get_oid( \
(sai_object_type_t)SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \
object_type ## _id, \
attr_count, \
attr_list, \
&redis_generic_get); \
}

#define REDIS_GENERIC_QUAD(OT,ot) \
Expand Down Expand Up @@ -145,7 +145,7 @@
sai_status_t redis_get_ ## object_type ## _stats( \
_In_ sai_object_id_t object_type ## _id, \
_In_ uint32_t number_of_counters, \
_In_ const sai_ ## object_type ## _stat_t *counter_ids, \
_In_ const sai_stat_id_t *counter_ids, \
_Out_ uint64_t *counters) \
{ \
MUTEX(); \
Expand All @@ -164,7 +164,7 @@
sai_status_t redis_get_ ## object_type ## _stats_ext( \
_In_ sai_object_id_t object_type ## _id, \
_In_ uint32_t number_of_counters, \
_In_ const sai_ ## object_type ## _stat_t *counter_ids, \
_In_ const sai_stat_id_t *counter_ids, \
_In_ sai_stats_mode_t mode, \
_Out_ uint64_t *counters) \
{ \
Expand All @@ -184,7 +184,7 @@
sai_status_t redis_clear_ ## object_type ## _stats( \
_In_ sai_object_id_t object_type ## _id, \
_In_ uint32_t number_of_counters, \
_In_ const sai_ ## object_type ## _stat_t *counter_ids) \
_In_ const sai_stat_id_t *counter_ids) \
{ \
MUTEX(); \
SWSS_LOG_ENTER(); \
Expand Down
2 changes: 1 addition & 1 deletion lib/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

if DEBUG
DBGFLAGS = -ggdb -D_DEBUG_
Expand Down
4 changes: 2 additions & 2 deletions lib/src/sai_redis_generic_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sai_object_type_t sai_object_type_query(

sai_object_type_t ot = (sai_object_type_t)((object_id >> 48) & 0xFF);

if (ot == SAI_OBJECT_TYPE_NULL || ot >= SAI_OBJECT_TYPE_MAX)
if (ot == SAI_OBJECT_TYPE_NULL || ot >= SAI_OBJECT_TYPE_EXTENSIONS_MAX)
{
SWSS_LOG_ERROR("invalid object id 0x%lx", object_id);

Expand Down Expand Up @@ -156,7 +156,7 @@ sai_object_id_t redis_create_virtual_object_id(
SWSS_LOG_ENTER();

if ((object_type <= SAI_OBJECT_TYPE_NULL) ||
(object_type >= SAI_OBJECT_TYPE_MAX))
(object_type >= SAI_OBJECT_TYPE_EXTENSIONS_MAX))
{
SWSS_LOG_THROW("invalid objct type: %d", object_type);
}
Expand Down
16 changes: 2 additions & 14 deletions lib/src/sai_redis_uburst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,12 @@
#include "sai_redis_internal.h"

REDIS_GENERIC_QUAD(TAM_MICROBURST,tam_microburst);
REDIS_GENERIC_STATS(TAM_MICROBURST,tam_microburst);
REDIS_GENERIC_QUAD(TAM_HISTOGRAM,tam_histogram);

sai_status_t redis_get_tam_histogram_stats(
_In_ sai_object_id_t tam_histogram_id,
_Inout_ uint32_t *number_of_counters,
_Out_ uint64_t *counters)
{
MUTEX();

SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

const sai_uburst_api_t redis_uburst_api = {

REDIS_GENERIC_QUAD_API(tam_microburst)
REDIS_GENERIC_STATS_API(tam_microburst)
REDIS_GENERIC_QUAD_API(tam_histogram)

redis_get_tam_histogram_stats
};
2 changes: 1 addition & 1 deletion meta/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# since we have SAI sumbodule we will use submodule headers
AM_CPPFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

if DEBUG
DBGFLAGS = -ggdb -D_DEBUG_
Expand Down
2 changes: 1 addition & 1 deletion meta/sai_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5533,7 +5533,7 @@ sai_status_t meta_sai_validate_oid(
SWSS_LOG_ENTER();

if (object_type <= SAI_OBJECT_TYPE_NULL ||
object_type >= SAI_OBJECT_TYPE_MAX)
object_type >= SAI_OBJECT_TYPE_EXTENSIONS_MAX)
{
SWSS_LOG_ERROR("invalid object type specified: %d, FIXME", object_type);
return SAI_STATUS_INVALID_PARAMETER;
Expand Down
12 changes: 0 additions & 12 deletions meta/sai_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,6 @@ void sai_deserialize_free_queue_deadlock_ntf(
_In_ uint32_t count,
_In_ sai_queue_deadlock_notification_data_t* deadlock_data);

void sai_deserialize_port_stat(
_In_ const std::string& s,
_Out_ sai_port_stat_t& stat);

void sai_deserialize_queue_stat(
_In_ const std::string& s,
_Out_ sai_queue_stat_t& stat);

void sai_deserialize_ingress_priority_group_stat(
_In_ const std::string& s,
_Out_ sai_ingress_priority_group_stat_t& stat);

void sai_deserialize_ingress_priority_group_attr(
_In_ const std::string& s,
_Out_ sai_ingress_priority_group_attr_t& attr);
Expand Down
31 changes: 2 additions & 29 deletions meta/saiserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ std::string sai_serialize_object_meta_key(

std::string key;

if (meta_key.objecttype == SAI_OBJECT_TYPE_NULL || meta_key.objecttype >= SAI_OBJECT_TYPE_MAX)
if (meta_key.objecttype == SAI_OBJECT_TYPE_NULL || meta_key.objecttype >= SAI_OBJECT_TYPE_EXTENSIONS_MAX)
{
SWSS_LOG_THROW("invalid object type value %s", sai_serialize_object_type(meta_key.objecttype).c_str());
}
Expand Down Expand Up @@ -2631,7 +2631,7 @@ void sai_deserialize_object_meta_key(

sai_deserialize_object_type(str_object_type, meta_key.objecttype);

if (meta_key.objecttype == SAI_OBJECT_TYPE_NULL || meta_key.objecttype >= SAI_OBJECT_TYPE_MAX)
if (meta_key.objecttype == SAI_OBJECT_TYPE_NULL || meta_key.objecttype >= SAI_OBJECT_TYPE_EXTENSIONS_MAX)
{
SWSS_LOG_THROW("invalid object type value %s", sai_serialize_object_type(meta_key.objecttype).c_str());
}
Expand Down Expand Up @@ -2943,33 +2943,6 @@ void sai_deserialize_free_queue_deadlock_ntf(
delete[] queue_deadlock;
}

void sai_deserialize_port_stat(
_In_ const std::string& s,
_Out_ sai_port_stat_t& stat)
{
SWSS_LOG_ENTER();

sai_deserialize_enum(s, &sai_metadata_enum_sai_port_stat_t, (int32_t&)stat);
}

void sai_deserialize_queue_stat(
_In_ const std::string& s,
_Out_ sai_queue_stat_t& stat)
{
SWSS_LOG_ENTER();

sai_deserialize_enum(s, &sai_metadata_enum_sai_queue_stat_t, (int32_t&)stat);
}

void sai_deserialize_ingress_priority_group_stat(
_In_ const std::string& s,
_Out_ sai_ingress_priority_group_stat_t& stat)
{
SWSS_LOG_ENTER();

sai_deserialize_enum(s, &sai_metadata_enum_sai_ingress_priority_group_stat_t, (int32_t&)stat);
}

void sai_deserialize_ingress_priority_group_attr(
_In_ const std::string& s,
_Out_ sai_ingress_priority_group_attr_t& attr)
Expand Down
4 changes: 2 additions & 2 deletions meta/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sai_object_type_t sai_object_type_query(
sai_object_type_t objecttype = (sai_object_type_t)((oid >> 48) & 0xFF);

if ((objecttype <= SAI_OBJECT_TYPE_NULL) ||
(objecttype >= SAI_OBJECT_TYPE_MAX))
(objecttype >= SAI_OBJECT_TYPE_EXTENSIONS_MAX))
{
SWSS_LOG_THROW("invalid oid 0x%lx", oid);
}
Expand Down Expand Up @@ -98,7 +98,7 @@ sai_object_id_t create_dummy_object_id(
SWSS_LOG_ENTER();

if ((object_type <= SAI_OBJECT_TYPE_NULL) ||
(object_type >= SAI_OBJECT_TYPE_MAX))
(object_type >= SAI_OBJECT_TYPE_EXTENSIONS_MAX))
{
SWSS_LOG_THROW("invalid objct type: %d", object_type);
}
Expand Down
2 changes: 1 addition & 1 deletion saidiscovery/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = saidiscovery

Expand Down
2 changes: 1 addition & 1 deletion saidump/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = saidump

Expand Down
2 changes: 1 addition & 1 deletion saiplayer/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = saiplayer

Expand Down
2 changes: 1 addition & 1 deletion saisdkdump/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = saisdkdump

Expand Down
2 changes: 1 addition & 1 deletion syncd/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = syncd syncd_request_shutdown tests

Expand Down
12 changes: 6 additions & 6 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,7 @@ std::vector<T> extractCounterIdsGeneric(
{
std::string field = fvField(v);
T counterId;
deserializeIdFn(field, counterId);
deserializeIdFn(field.c_str(), &counterId);

counterIdList.push_back(counterId);
}
Expand All @@ -1842,7 +1842,7 @@ sai_status_t getStatsGeneric(
return getStatsFn(
object_id,
(uint32_t)counter_ids.size(),
counter_ids.data(),
(const sai_stat_id_t*)counter_ids.data(),
counters.data());
}

Expand Down Expand Up @@ -2626,7 +2626,7 @@ sai_status_t processEvent(
* TODO: use metadata utils is object type valid.
*/

if (object_type == SAI_OBJECT_TYPE_NULL || object_type >= SAI_OBJECT_TYPE_MAX)
if (object_type == SAI_OBJECT_TYPE_NULL || object_type >= SAI_OBJECT_TYPE_EXTENSIONS_MAX)
{
SWSS_LOG_THROW("undefined object type %s", sai_serialize_object_type(object_type).c_str());
}
Expand Down Expand Up @@ -2906,7 +2906,7 @@ void processFlexCounterEvent(
for (const auto &str : idStrings)
{
sai_port_stat_t stat;
sai_deserialize_port_stat(str, stat);
sai_deserialize_port_stat(str.c_str(), &stat);
portCounterIds.push_back(stat);
}
FlexCounter::setPortCounterList(vid, rid, groupName, portCounterIds);
Expand All @@ -2917,7 +2917,7 @@ void processFlexCounterEvent(
for (const auto &str : idStrings)
{
sai_queue_stat_t stat;
sai_deserialize_queue_stat(str, stat);
sai_deserialize_queue_stat(str.c_str(), &stat);
queueCounterIds.push_back(stat);
}
FlexCounter::setQueueCounterList(vid, rid, groupName, queueCounterIds);
Expand All @@ -2940,7 +2940,7 @@ void processFlexCounterEvent(
for (const auto &str : idStrings)
{
sai_ingress_priority_group_stat_t stat;
sai_deserialize_ingress_priority_group_stat(str, stat);
sai_deserialize_ingress_priority_group_stat(str.c_str(), &stat);
pgCounterIds.push_back(stat);
}
FlexCounter::setPriorityGroupCounterList(vid, rid, groupName, pgCounterIds);
Expand Down
2 changes: 1 addition & 1 deletion syncd/syncd_applyview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6589,7 +6589,7 @@ void logViewObjectCount(

bool asic_changes = false;

for (int i = SAI_OBJECT_TYPE_NULL + 1; i < SAI_OBJECT_TYPE_MAX; i++)
for (int i = SAI_OBJECT_TYPE_NULL + 1; i < SAI_OBJECT_TYPE_EXTENSIONS_MAX; i++)
{
sai_object_type_t ot = (sai_object_type_t)i;

Expand Down
Loading

0 comments on commit 8793562

Please sign in to comment.