From 87935628e0214494c4e9576efff1362a60da107f Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 18 Jan 2019 22:19:17 +0200 Subject: [PATCH] Update SAI pointer to latest master (#408) * Update SAI pointer to latest master Signed-off-by: Marian Pritsak * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak --- SAI | 2 +- lib/inc/sai_redis_internal.h | 110 +++++++++++++-------------- lib/src/Makefile.am | 2 +- lib/src/sai_redis_generic_create.cpp | 4 +- lib/src/sai_redis_uburst.cpp | 16 +--- meta/Makefile.am | 2 +- meta/sai_meta.cpp | 2 +- meta/sai_serialize.h | 12 --- meta/saiserialize.cpp | 31 +------- meta/tests.cpp | 4 +- saidiscovery/Makefile.am | 2 +- saidump/Makefile.am | 2 +- saiplayer/Makefile.am | 2 +- saisdkdump/Makefile.am | 2 +- syncd/Makefile.am | 2 +- syncd/syncd.cpp | 12 +-- syncd/syncd_applyview.cpp | 2 +- syncd/syncd_flex_counter.cpp | 20 ++--- syncd/syncd_hard_reinit.cpp | 5 +- tests/Makefile.am | 2 +- vslib/inc/sai_vs_internal.h | 6 +- vslib/src/Makefile.am | 2 +- vslib/src/sai_vs_uburst.cpp | 16 +--- vslib/src/tests.cpp | 8 +- 24 files changed, 102 insertions(+), 166 deletions(-) diff --git a/SAI b/SAI index 725560c5f929..f9bedb1dc880 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit 725560c5f92987b433d54fabbf8d232faa0d30b7 +Subproject commit f9bedb1dc880c0b3667c5977458b11807e57ae1b diff --git a/lib/inc/sai_redis_internal.h b/lib/inc/sai_redis_internal.h index 47aae5a35b4f..90ef01a3cb8e 100644 --- a/lib/inc/sai_redis_internal.h +++ b/lib/inc/sai_redis_internal.h @@ -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) \ @@ -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(); \ @@ -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) \ { \ @@ -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(); \ diff --git a/lib/src/Makefile.am b/lib/src/Makefile.am index 706bdc23becd..f24fc370ac36 100644 --- a/lib/src/Makefile.am +++ b/lib/src/Makefile.am @@ -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_ diff --git a/lib/src/sai_redis_generic_create.cpp b/lib/src/sai_redis_generic_create.cpp index 33092c365f96..bf1c0da0f675 100644 --- a/lib/src/sai_redis_generic_create.cpp +++ b/lib/src/sai_redis_generic_create.cpp @@ -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); @@ -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); } diff --git a/lib/src/sai_redis_uburst.cpp b/lib/src/sai_redis_uburst.cpp index 46e9bbe5dba5..580a63cd99cc 100644 --- a/lib/src/sai_redis_uburst.cpp +++ b/lib/src/sai_redis_uburst.cpp @@ -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 }; diff --git a/meta/Makefile.am b/meta/Makefile.am index 842b3ed88558..cd2013b20d16 100644 --- a/meta/Makefile.am +++ b/meta/Makefile.am @@ -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_ diff --git a/meta/sai_meta.cpp b/meta/sai_meta.cpp index 657d2286be18..731db361c956 100644 --- a/meta/sai_meta.cpp +++ b/meta/sai_meta.cpp @@ -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; diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index cd7cda5cd864..1f1d8832fd66 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -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); diff --git a/meta/saiserialize.cpp b/meta/saiserialize.cpp index e75e7040fb49..d04371452a46 100644 --- a/meta/saiserialize.cpp +++ b/meta/saiserialize.cpp @@ -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()); } @@ -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()); } @@ -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) diff --git a/meta/tests.cpp b/meta/tests.cpp index b5330500b57a..6f8daadc288f 100644 --- a/meta/tests.cpp +++ b/meta/tests.cpp @@ -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); } @@ -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); } diff --git a/saidiscovery/Makefile.am b/saidiscovery/Makefile.am index 04c49968b596..6bcc5c39ff7d 100644 --- a/saidiscovery/Makefile.am +++ b/saidiscovery/Makefile.am @@ -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 diff --git a/saidump/Makefile.am b/saidump/Makefile.am index 1832f32e3741..63d87f773a04 100644 --- a/saidump/Makefile.am +++ b/saidump/Makefile.am @@ -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 diff --git a/saiplayer/Makefile.am b/saiplayer/Makefile.am index a78cb49a4755..a64bf7b958a2 100644 --- a/saiplayer/Makefile.am +++ b/saiplayer/Makefile.am @@ -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 diff --git a/saisdkdump/Makefile.am b/saisdkdump/Makefile.am index 938d076ef917..486e5120b85f 100644 --- a/saisdkdump/Makefile.am +++ b/saisdkdump/Makefile.am @@ -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 diff --git a/syncd/Makefile.am b/syncd/Makefile.am index 0719a2da00bb..7384fb4cca47 100644 --- a/syncd/Makefile.am +++ b/syncd/Makefile.am @@ -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 diff --git a/syncd/syncd.cpp b/syncd/syncd.cpp index 49c7fae1fbda..19d34c39b3ed 100644 --- a/syncd/syncd.cpp +++ b/syncd/syncd.cpp @@ -1816,7 +1816,7 @@ std::vector extractCounterIdsGeneric( { std::string field = fvField(v); T counterId; - deserializeIdFn(field, counterId); + deserializeIdFn(field.c_str(), &counterId); counterIdList.push_back(counterId); } @@ -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()); } @@ -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()); } @@ -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); @@ -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); @@ -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); diff --git a/syncd/syncd_applyview.cpp b/syncd/syncd_applyview.cpp index 71cd1ddd1b8e..b8db06ccf437 100644 --- a/syncd/syncd_applyview.cpp +++ b/syncd/syncd_applyview.cpp @@ -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; diff --git a/syncd/syncd_flex_counter.cpp b/syncd/syncd_flex_counter.cpp index 145209d783c2..22fd6393e755 100644 --- a/syncd/syncd_flex_counter.cpp +++ b/syncd/syncd_flex_counter.cpp @@ -204,7 +204,7 @@ void FlexCounter::setQueueCounterList( sai_status_t status = sai_metadata_sai_queue_api->get_queue_stats( queueId, static_cast(supportedIds.size()), - supportedIds.data(), + (const sai_stat_id_t *)supportedIds.data(), queueStats.data()); if (status != SAI_STATUS_SUCCESS) @@ -304,7 +304,7 @@ void FlexCounter::setPriorityGroupCounterList( sai_status_t status = sai_metadata_sai_buffer_api->get_ingress_priority_group_stats( priorityGroupId, static_cast(supportedIds.size()), - supportedIds.data(), + (const sai_stat_id_t *)supportedIds.data(), priorityGroupStats.data()); if (status != SAI_STATUS_SUCCESS) @@ -667,7 +667,7 @@ void FlexCounter::collectCounters( sai_status_t status = sai_metadata_sai_port_api->get_port_stats( portId, static_cast(portCounterIds.size()), - portCounterIds.data(), + (const sai_stat_id_t *)portCounterIds.data(), portStats.data()); if (status != SAI_STATUS_SUCCESS) { @@ -712,13 +712,13 @@ void FlexCounter::collectCounters( status = sai_metadata_sai_queue_api->get_queue_stats( queueId, static_cast(queueCounterIds.size()), - queueCounterIds.data(), + (const sai_stat_id_t *)queueCounterIds.data(), queueStats.data()); if (m_statsMode == SAI_STATS_MODE_READ_AND_CLEAR){ status = sai_metadata_sai_queue_api->clear_queue_stats( queueId, static_cast(queueCounterIds.size()), - queueCounterIds.data()); + (const sai_stat_id_t *)queueCounterIds.data()); } if (status != SAI_STATUS_SUCCESS) @@ -799,13 +799,13 @@ void FlexCounter::collectCounters( status = sai_metadata_sai_buffer_api->get_ingress_priority_group_stats( priorityGroupId, static_cast(priorityGroupCounterIds.size()), - priorityGroupCounterIds.data(), + (const sai_stat_id_t *)priorityGroupCounterIds.data(), priorityGroupStats.data()); if (m_statsMode == SAI_STATS_MODE_READ_AND_CLEAR){ status = sai_metadata_sai_buffer_api->clear_ingress_priority_group_stats( priorityGroupId, static_cast(priorityGroupCounterIds.size()), - priorityGroupCounterIds.data()); + (const sai_stat_id_t *)priorityGroupCounterIds.data()); } if (status != SAI_STATUS_SUCCESS) @@ -1021,7 +1021,7 @@ void FlexCounter::saiUpdateSupportedPortCounters(sai_object_id_t portId) { sai_port_stat_t counter = static_cast(cntr_id); - sai_status_t status = sai_metadata_sai_port_api->get_port_stats(portId, 1, &counter, &value); + sai_status_t status = sai_metadata_sai_port_api->get_port_stats(portId, 1, (const sai_stat_id_t *)&counter, &value); if (status != SAI_STATUS_SUCCESS) { @@ -1048,7 +1048,7 @@ void FlexCounter::saiUpdateSupportedQueueCounters( for (auto &counter : counterIds) { - sai_status_t status = sai_metadata_sai_queue_api->get_queue_stats(queueId, 1, &counter, &value); + sai_status_t status = sai_metadata_sai_queue_api->get_queue_stats(queueId, 1, (const sai_stat_id_t *)&counter, &value); if (status != SAI_STATUS_SUCCESS) { @@ -1077,7 +1077,7 @@ void FlexCounter::saiUpdateSupportedPriorityGroupCounters( for (auto &counter : counterIds) { - sai_status_t status = sai_metadata_sai_buffer_api->get_ingress_priority_group_stats(priorityGroupId, 1, &counter, &value); + sai_status_t status = sai_metadata_sai_buffer_api->get_ingress_priority_group_stats(priorityGroupId, 1, (const sai_stat_id_t *)&counter, &value); if (status != SAI_STATUS_SUCCESS) { diff --git a/syncd/syncd_hard_reinit.cpp b/syncd/syncd_hard_reinit.cpp index e4753bdd50f5..a827928ef068 100644 --- a/syncd/syncd_hard_reinit.cpp +++ b/syncd/syncd_hard_reinit.cpp @@ -68,7 +68,7 @@ sai_object_type_t getObjectTypeFromVid( sai_object_type_t objectType = redis_sai_object_type_query(object_vid); // TODO metadata is valid object type - if (objectType >= SAI_OBJECT_TYPE_MAX || + if (objectType >= SAI_OBJECT_TYPE_EXTENSIONS_MAX || objectType == SAI_OBJECT_TYPE_NULL) { SWSS_LOG_THROW("invalid object type: %s on object id: %s", @@ -117,8 +117,7 @@ sai_object_type_t getObjectTypeFromAsicKey( sai_deserialize_object_type(strObjectType, objectType); // TODO metadata utils is valid object:t - if (objectType >= SAI_OBJECT_TYPE_MAX || - objectType == SAI_OBJECT_TYPE_NULL) + if (objectType >= SAI_OBJECT_TYPE_EXTENSIONS_MAX || objectType == SAI_OBJECT_TYPE_NULL) { SWSS_LOG_THROW("invalid object type: %s on asic key: %s", sai_serialize_object_type(objectType).c_str(), diff --git a/tests/Makefile.am b/tests/Makefile.am index 7fc33dfb3008..2fe133ae8282 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 = vssyncd diff --git a/vslib/inc/sai_vs_internal.h b/vslib/inc/sai_vs_internal.h index 973f0a05474d..aa49eb8d9791 100644 --- a/vslib/inc/sai_vs_internal.h +++ b/vslib/inc/sai_vs_internal.h @@ -146,7 +146,7 @@ sai_status_t vs_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(); \ @@ -164,7 +164,7 @@ sai_status_t vs_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) \ { \ @@ -184,7 +184,7 @@ sai_status_t vs_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(); \ diff --git a/vslib/src/Makefile.am b/vslib/src/Makefile.am index 2129175487fe..b50cbdfae3f2 100644 --- a/vslib/src/Makefile.am +++ b/vslib/src/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I/usr/include/libnl3 +AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I/usr/include/libnl3 -I$(top_srcdir)/SAI/experimental if DEBUG DBGFLAGS = -ggdb -D_DEBUG_ diff --git a/vslib/src/sai_vs_uburst.cpp b/vslib/src/sai_vs_uburst.cpp index 70de5bc7440a..3c70634e336d 100644 --- a/vslib/src/sai_vs_uburst.cpp +++ b/vslib/src/sai_vs_uburst.cpp @@ -2,24 +2,12 @@ #include "sai_vs_internal.h" VS_GENERIC_QUAD(TAM_MICROBURST,tam_microburst); +VS_GENERIC_STATS(TAM_MICROBURST,tam_microburst); VS_GENERIC_QUAD(TAM_HISTOGRAM,tam_histogram); -sai_status_t vs_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 vs_uburst_api = { VS_GENERIC_QUAD_API(tam_microburst) + VS_GENERIC_STATS_API(tam_microburst) VS_GENERIC_QUAD_API(tam_histogram) - - vs_get_tam_histogram_stats }; diff --git a/vslib/src/tests.cpp b/vslib/src/tests.cpp index 267f931413bb..07efe66e6470 100644 --- a/vslib/src/tests.cpp +++ b/vslib/src/tests.cpp @@ -297,7 +297,7 @@ void test_set_stats_via_redis() sai_port_stat_t ids[1] = { SAI_PORT_STAT_IF_IN_ERRORS }; uint64_t counters[1] = { 0 } ; - SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports.at(0), 1, ids, counters)); + SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports.at(0), 1, (const sai_stat_id_t *)ids, counters)); ASSERT_TRUE(counters[0] == 42); } @@ -706,7 +706,7 @@ void test_get_stats() values[0] = 42; values[1] = 42; - SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2, ids, values)); + SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2, (const sai_stat_id_t *)ids, values)); ASSERT_TRUE(values[0] == 0); ASSERT_TRUE(values[1] == 0); @@ -717,7 +717,7 @@ void test_get_stats() values[1] = 127; // setting last bit of count value when unittest are enabled, will cause to perform SET on counters - SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2 | 0x80000000, ids, values)); + SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2 | 0x80000000, (const sai_stat_id_t *)ids, values)); values[0] = 42; values[1] = 42; @@ -727,7 +727,7 @@ void test_get_stats() ids[0] = SAI_PORT_STAT_IF_OUT_OCTETS; ids[1] = SAI_PORT_STAT_IF_IN_OCTETS; - SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2, ids, values)); + SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports[0], 2, (const sai_stat_id_t *)ids, values)); ASSERT_TRUE(values[0] == 127); ASSERT_TRUE(values[1] == 77);