Skip to content

Commit

Permalink
adjust sendPacketCpuAndFrontPanel to enable more logging
Browse files Browse the repository at this point in the history
Summary: As titled, adjust sendPacketCpuAndFrontPanel to enable more logging

Reviewed By: jasmeetbagga

Differential Revision: D51293863

fbshipit-source-id: e55eeff6de5eb373fc87136847bb90bdbc19f539
  • Loading branch information
srikrishnagopu authored and facebook-github-bot committed Nov 15, 2023
1 parent 0d205b4 commit 5c42374
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions fboss/agent/hw/test/HwVoqSwitchTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,24 +509,15 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {
getLatestPortStats(kPort.phyPortID()).get_outBytes_());
};

auto getQueueOutPktsBytes = [kPort, this]() {
auto getAllQueueOutPktsBytes = [kPort, this]() {
return std::make_pair(
getLatestPortStats(kPort.phyPortID())
.get_queueOutPackets_()
.at(kDefaultQueue),
getLatestPortStats(kPort.phyPortID())
.get_queueOutBytes_()
.at(kDefaultQueue));
getLatestPortStats(kPort.phyPortID()).get_queueOutPackets_(),
getLatestPortStats(kPort.phyPortID()).get_queueOutBytes_());
};
auto getVoQOutBytes = [kPort, this]() {
if (!getAsic()->isSupported(HwAsic::Feature::VOQ)) {
return 0L;
}
auto getAllVoQOutBytes = [kPort, this]() {
return getLatestSysPortStats(getSystemPortID(kPort))
.get_queueOutBytes_()
.at(kDefaultQueue);
.get_queueOutBytes_();
};

auto getAclPackets = [this]() {
return utility::getAclInOutPackets(
getHwSwitch(),
Expand All @@ -537,14 +528,17 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {

int64_t beforeQueueOutPkts = 0, beforeQueueOutBytes = 0;
int64_t afterQueueOutPkts = 0, afterQueueOutBytes = 0;
int64_t beforeVoQOutBytes = 0, afterVoQOutBytes = 0;

auto beforeVoQOutBytes = getVoQOutBytes();
if (getAsic()->isSupported(HwAsic::Feature::L3_QOS)) {
auto beforeQueueOut = getQueueOutPktsBytes();
beforeQueueOutPkts = beforeQueueOut.first;
beforeQueueOutBytes = beforeQueueOut.second;
auto beforeAllQueueOut = getAllQueueOutPktsBytes();
beforeQueueOutPkts = beforeAllQueueOut.first.at(kDefaultQueue);
beforeQueueOutBytes = beforeAllQueueOut.second.at(kDefaultQueue);
}

auto beforeAllVoQOutBytes = getAllVoQOutBytes();
beforeVoQOutBytes = beforeAllVoQOutBytes.at(kDefaultQueue);

auto [beforeOutPkts, beforeOutBytes] = getPortOutPktsBytes();
auto beforeAclPkts =
isSupported(HwAsic::Feature::ACL_TABLE_GROUP) ? getAclPackets() : 0;
Expand All @@ -558,10 +552,12 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {
utility::getRetryCountAndDelay(getAsic());
WITH_RETRIES_N_TIMED(
maxRetryCount, std::chrono::milliseconds(sleepTimeMsecs), {
auto afterVoQOutBytes = getVoQOutBytes();
auto afterAllVoQOutBytes = getAllVoQOutBytes();
afterVoQOutBytes = afterAllVoQOutBytes.at(kDefaultQueue);
if (getAsic()->isSupported(HwAsic::Feature::L3_QOS)) {
std::tie(afterQueueOutPkts, afterQueueOutBytes) =
getQueueOutPktsBytes();
auto afterAllQueueOut = getAllQueueOutPktsBytes();
afterQueueOutPkts = afterAllQueueOut.first.at(kDefaultQueue);
afterQueueOutBytes = afterAllQueueOut.second.at(kDefaultQueue);
}
auto afterAclPkts = isSupported(HwAsic::Feature::ACL_TABLE_GROUP)
? getAclPackets()
Expand Down

0 comments on commit 5c42374

Please sign in to comment.