From 59e530a485bbe419f30779fe5f7058ff5bbaade8 Mon Sep 17 00:00:00 2001 From: Danny Allen <52468448+daall@users.noreply.github.com> Date: Fri, 20 Sep 2019 10:00:47 -0700 Subject: [PATCH] Add support for debug counters (#517) --- lib/inc/sai_redis.h | 1 + lib/src/Makefile.am | 1 + lib/src/sai_redis_debug_counter.cpp | 7 +++++++ lib/src/sai_redis_interfacequery.cpp | 1 + vslib/inc/sai_vs.h | 1 + vslib/src/Makefile.am | 3 ++- vslib/src/sai_vs_debug_counter.cpp | 8 ++++++++ 7 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lib/src/sai_redis_debug_counter.cpp create mode 100644 vslib/src/sai_vs_debug_counter.cpp diff --git a/lib/inc/sai_redis.h b/lib/inc/sai_redis.h index e0fd780f63bc..7473fb7a501d 100644 --- a/lib/inc/sai_redis.h +++ b/lib/inc/sai_redis.h @@ -112,6 +112,7 @@ extern const sai_udf_api_t redis_udf_api; extern const sai_virtual_router_api_t redis_virtual_router_api; extern const sai_vlan_api_t redis_vlan_api; extern const sai_wred_api_t redis_wred_api; +extern const sai_debug_counter_api_t redis_debug_counter_api; #define UNREFERENCED_PARAMETER(X) diff --git a/lib/src/Makefile.am b/lib/src/Makefile.am index da695a12b8c1..264e26a70394 100644 --- a/lib/src/Makefile.am +++ b/lib/src/Makefile.am @@ -14,6 +14,7 @@ libsairedis_la_SOURCES = \ sai_redis_bmtor.cpp \ sai_redis_bridge.cpp \ sai_redis_buffer.cpp \ + sai_redis_debug_counter.cpp \ sai_redis_dtel.cpp \ sai_redis_fdb.cpp \ sai_redis_hash.cpp \ diff --git a/lib/src/sai_redis_debug_counter.cpp b/lib/src/sai_redis_debug_counter.cpp new file mode 100644 index 000000000000..a810db6e7290 --- /dev/null +++ b/lib/src/sai_redis_debug_counter.cpp @@ -0,0 +1,7 @@ +#include "sai_redis.h" + +REDIS_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); + +const sai_debug_counter_api_t redis_debug_counter_api = { + REDIS_GENERIC_QUAD_API(debug_counter) +}; diff --git a/lib/src/sai_redis_interfacequery.cpp b/lib/src/sai_redis_interfacequery.cpp index 16fb96accc30..ac4ab5bf3b72 100644 --- a/lib/src/sai_redis_interfacequery.cpp +++ b/lib/src/sai_redis_interfacequery.cpp @@ -251,6 +251,7 @@ sai_status_t sai_api_query( API_CASE(VIRTUAL_ROUTER,virtual_router); API_CASE(VLAN,vlan); API_CASE(WRED,wred); + API_CASE(DEBUG_COUNTER,debug_counter); default: SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); diff --git a/vslib/inc/sai_vs.h b/vslib/inc/sai_vs.h index ef9578822626..6dfaed74d20a 100644 --- a/vslib/inc/sai_vs.h +++ b/vslib/inc/sai_vs.h @@ -145,6 +145,7 @@ extern const sai_udf_api_t vs_udf_api; extern const sai_virtual_router_api_t vs_virtual_router_api; extern const sai_vlan_api_t vs_vlan_api; extern const sai_wred_api_t vs_wred_api; +extern const sai_debug_counter_api_t vs_debug_counter_api; // OID QUAD diff --git a/vslib/src/Makefile.am b/vslib/src/Makefile.am index dc3fd73f070e..b3877b83254d 100644 --- a/vslib/src/Makefile.am +++ b/vslib/src/Makefile.am @@ -11,9 +11,10 @@ lib_LTLIBRARIES = libsaivs.la libsaivs_la_SOURCES = \ sai_vs_acl.cpp \ sai_vs_bfd.cpp \ - sai_vs_bmtor.cpp \ + sai_vs_bmtor.cpp \ sai_vs_bridge.cpp \ sai_vs_buffer.cpp \ + sai_vs_debug_counter.cpp\ sai_vs_dtel.cpp \ sai_vs_fdb.cpp \ sai_vs_hash.cpp \ diff --git a/vslib/src/sai_vs_debug_counter.cpp b/vslib/src/sai_vs_debug_counter.cpp new file mode 100644 index 000000000000..20c0c22c8156 --- /dev/null +++ b/vslib/src/sai_vs_debug_counter.cpp @@ -0,0 +1,8 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); + +const sai_debug_counter_api_t vs_debug_counter_api = { + VS_GENERIC_QUAD_API(debug_counter) +};