Skip to content

Commit

Permalink
Add egress GVOQ watermark byte stats for queues
Browse files Browse the repository at this point in the history
Summary:
Egress GVOQ watermark bytes gives a view of the total buffer usage
across the various VOQs mapping to a specific egress queue.

Reviewed By: jasmeetbagga

Differential Revision: D61809758

fbshipit-source-id: 40687e745f0d83d72cf3fe41c06e8ea0ef6ea2b1
  • Loading branch information
Nivin Lawrence authored and facebook-github-bot committed Aug 29, 2024
1 parent 1c5a0d1 commit cf50a38
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmake/AgentHwSaiApi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ if (SAI_TAJO_IMPL)
fboss/agent/hw/sai/api/tajo/SwitchApi.cpp
fboss/agent/hw/sai/api/tajo/DebugCounterApi.cpp
fboss/agent/hw/sai/api/tajo/BufferApi.cpp
fboss/agent/hw/sai/api/tajo/QueueApi.cpp
)

find_path(SAI_IMPL_DIR NAMES lib/libsai_impl.a)
Expand All @@ -102,6 +103,7 @@ elseif (SAI_BRCM_IMPL)
fboss/agent/hw/sai/api/bcm/SwitchApi.cpp
fboss/agent/hw/sai/api/bcm/DebugCounterApi.cpp
fboss/agent/hw/sai/api/bcm/BufferApi.cpp
fboss/agent/hw/sai/api/bcm/QueueApi.cpp
)

find_path(SAI_IMPL_DIR NAMES lib/libsai_impl.a)
Expand Down
1 change: 1 addition & 0 deletions fboss/agent/hw/sai/api/QueueApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct SaiQueueTraits {
WatermarkLevelCounterIdsToReadAndClear = {
SAI_QUEUE_STAT_WATERMARK_LEVEL,
};
static const std::vector<sai_stat_id_t>& egressGvoqWatermarkBytes();
};

SAI_ATTRIBUTE_NAME(Queue, Type)
Expand Down
4 changes: 4 additions & 0 deletions fboss/agent/hw/sai/api/api.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ brcm_srcs = common_srcs + [
"bcm/SwitchApi.cpp",
"bcm/TamApi.cpp",
"bcm/BufferApi.cpp",
"bcm/QueueApi.cpp",
]

tajo_srcs = common_srcs + [
Expand All @@ -45,6 +46,7 @@ tajo_srcs = common_srcs + [
"tajo/TamApi.cpp",
"tajo/SwitchApi.cpp",
"tajo/BufferApi.cpp",
"tajo/QueueApi.cpp",
]

credo_srcs = common_srcs + [
Expand All @@ -53,6 +55,7 @@ credo_srcs = common_srcs + [
"oss/SwitchApi.cpp",
"oss/TamApi.cpp",
"oss/BufferApi.cpp",
"oss/QueueApi.cpp",
]

mrvl_srcs = common_srcs + [
Expand All @@ -61,6 +64,7 @@ mrvl_srcs = common_srcs + [
"oss/SwitchApi.cpp",
"oss/TamApi.cpp",
"oss/BufferApi.cpp",
"oss/QueueApi.cpp",
]

common_headers = [
Expand Down
23 changes: 23 additions & 0 deletions fboss/agent/hw/sai/api/bcm/QueueApi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2004-present Facebook. All Rights Reserved.

#include "fboss/agent/hw/sai/api/QueueApi.h"

#if defined(BRCM_SAI_SDK_DNX) && defined(BRCM_SAI_SDK_GTE_11_0)
extern "C" {
#include <brcm_sai_extensions.h>
#include <sai.h>
}
#endif

namespace facebook::fboss {

const std::vector<sai_stat_id_t>& SaiQueueTraits::egressGvoqWatermarkBytes() {
#if defined(BRCM_SAI_SDK_DNX) && defined(BRCM_SAI_SDK_GTE_11_0)
static const std::vector<sai_stat_id_t> stats{
SAI_QUEUE_STAT_EGRESS_GVOQ_THRESHOLD_WM};
#else
static const std::vector<sai_stat_id_t> stats;
#endif
return stats;
}
} // namespace facebook::fboss
12 changes: 12 additions & 0 deletions fboss/agent/hw/sai/api/oss/QueueApi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2004-present Facebook. All Rights Reserved.

#include "fboss/agent/hw/sai/api/QueueApi.h"

namespace facebook::fboss {

const std::vector<sai_stat_id_t>& SaiQueueTraits::egressGvoqWatermarkBytes() {
static const std::vector<sai_stat_id_t> stats;
return stats;
}

} // namespace facebook::fboss
12 changes: 12 additions & 0 deletions fboss/agent/hw/sai/api/tajo/QueueApi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2004-present Facebook. All Rights Reserved.

#include "fboss/agent/hw/sai/api/QueueApi.h"

namespace facebook::fboss {

const std::vector<sai_stat_id_t>& SaiQueueTraits::egressGvoqWatermarkBytes() {
static const std::vector<sai_stat_id_t> stats;
return stats;
}

} // namespace facebook::fboss

0 comments on commit cf50a38

Please sign in to comment.