Skip to content

Commit

Permalink
Add new Pause traffic test to validate Pause with RX/TX/both enabled
Browse files Browse the repository at this point in the history
Summary: As titled

Reviewed By: jasmeetbagga

Differential Revision: D66528689

fbshipit-source-id: eab7164ce06b6d5812607ea82c13b82676d991e9
  • Loading branch information
Nivin Lawrence authored and facebook-github-bot committed Dec 2, 2024
1 parent 298e3fd commit 6969f94
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions fboss/agent/test/agent_hw_tests/AgentTrafficPauseTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,51 @@ class AgentTrafficPauseTest : public AgentHwTest {
verifyAcrossWarmBoots(setup, verify);
}
};
TEST_F(AgentTrafficPauseTest, verifyPauseRxOnly) {
// Enable pause RX alone
cfg::PortPause pauseCfg;
pauseCfg.tx() = false;
pauseCfg.rx() = true;
// Pause should slow down traffic significantly, lets say eventual
// rate should be less than 80% line rate!
auto rateChecker = [this](uint64_t rate, const PortID& portId) {
auto eightyPctLineRate =
static_cast<uint64_t>(
getProgrammedState()->getPorts()->getNodeIf(portId)->getSpeed()) *
1000 * 1000 * 0.8;
return rate && rate < eightyPctLineRate;
};
validateTrafficWithPause(pauseCfg, rateChecker);
}
TEST_F(AgentTrafficPauseTest, verifyPauseTxOnly) {
// Enable pause TX alone
cfg::PortPause pauseCfg;
pauseCfg.tx() = true;
pauseCfg.rx() = false;
// Pause should have no impact on traffic given only TX is enabled
auto rateChecker = [this](uint64_t rate, const PortID& portId) {
auto lineRate =
static_cast<uint64_t>(
getProgrammedState()->getPorts()->getNodeIf(portId)->getSpeed()) *
1000 * 1000;
return rate >= lineRate;
};
validateTrafficWithPause(pauseCfg, rateChecker);
}
TEST_F(AgentTrafficPauseTest, verifyPauseRxTx) {
// Enable both RX and TX pause
cfg::PortPause pauseCfg;
pauseCfg.tx() = true;
pauseCfg.rx() = true;
// Pause should slow down traffic significantly, lets say eventual
// rate should be less than 80% line rate!
auto rateChecker = [this](uint64_t rate, const PortID& portId) {
auto eightyPctLineRate =
static_cast<uint64_t>(
getProgrammedState()->getPorts()->getNodeIf(portId)->getSpeed()) *
1000 * 1000 * 0.8;
return rate && rate < eightyPctLineRate;
};
validateTrafficWithPause(pauseCfg, rateChecker);
}
} // namespace facebook::fboss

0 comments on commit 6969f94

Please sign in to comment.