From 4e80dbc616440d94afa7378612e759c6d04d4d34 Mon Sep 17 00:00:00 2001 From: Jasmeet Bagga Date: Sun, 29 Oct 2023 23:34:43 -0700 Subject: [PATCH] Implement MultiSwitchHandler::getSwitchDropStats Summary: As titled Reviewed By: srikrishnagopu Differential Revision: D50779681 fbshipit-source-id: 6cf1c63b435bd8305293eba0448db524c9e3372d --- fboss/agent/MultiHwSwitchHandler.cpp | 6 ++++++ fboss/agent/MultiHwSwitchHandler.h | 1 + fboss/agent/SwSwitch.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/fboss/agent/MultiHwSwitchHandler.cpp b/fboss/agent/MultiHwSwitchHandler.cpp index 43aa2d765051c..18b7ae5f65f8a 100644 --- a/fboss/agent/MultiHwSwitchHandler.cpp +++ b/fboss/agent/MultiHwSwitchHandler.cpp @@ -257,6 +257,12 @@ std::map MultiHwSwitchHandler::getSysPortStats() { return hwSwitchSyncers_.begin()->second->getSysPortStats(); } +HwSwitchDropStats MultiHwSwitchHandler::getSwitchDropStats() const { + // TODO - support with multiple switches + CHECK_EQ(hwSwitchSyncers_.size(), 1); + return hwSwitchSyncers_.begin()->second->getSwitchDropStats(); +} + void MultiHwSwitchHandler::updateStats() { return hwSwitchSyncers_.begin()->second->updateStats(); } diff --git a/fboss/agent/MultiHwSwitchHandler.h b/fboss/agent/MultiHwSwitchHandler.h index bb97a9170b0d7..0c2138481e6e4 100644 --- a/fboss/agent/MultiHwSwitchHandler.h +++ b/fboss/agent/MultiHwSwitchHandler.h @@ -95,6 +95,7 @@ class MultiHwSwitchHandler { CpuPortStats getCpuPortStats(); std::map getSysPortStats(); + HwSwitchDropStats getSwitchDropStats() const; void updateStats(); diff --git a/fboss/agent/SwSwitch.cpp b/fboss/agent/SwSwitch.cpp index f03cd24908a4b..e8a5a7c7d57a8 100644 --- a/fboss/agent/SwSwitch.cpp +++ b/fboss/agent/SwSwitch.cpp @@ -637,6 +637,7 @@ AgentStats SwSwitch::fillFsdbStats() { multiswitch::HwSwitchStats hwStats; hwStats.hwPortStats() = multiHwSwitchHandler_->getPortStats(); hwStats.sysPortStats() = multiHwSwitchHandler_->getSysPortStats(); + hwStats.switchDropStats() = multiHwSwitchHandler_->getSwitchDropStats(); if (auto hwSwitchStats = multiHwSwitchHandler_->getSwitchStats()) { hwStats.hwAsicErrors() = hwSwitchStats->getHwAsicErrors();