From cc93e3c73db191697e91cb42ca10a0048a9da9d8 Mon Sep 17 00:00:00 2001 From: Ram Singamala Date: Thu, 29 Oct 2026 11:36:54 -0700 Subject: [PATCH] Accept one fewer forwarded WRED packet on Ebro, Yuba, and G202X. The test setup can leave one extra packet in the queue, so these ASICs may forward one packet fewer and drop one more. --- .../test/agent_hw_tests/AgentAqmTests.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/fboss/agent/test/agent_hw_tests/AgentAqmTests.cpp b/fboss/agent/test/agent_hw_tests/AgentAqmTests.cpp index f99f1777f71e8..9dc41949e30f3 100644 --- a/fboss/agent/test/agent_hw_tests/AgentAqmTests.cpp +++ b/fboss/agent/test/agent_hw_tests/AgentAqmTests.cpp @@ -582,6 +582,21 @@ class AgentAqmTest : public AgentHwTest { const uint64_t kExpectedOutPackets = isEct(ecnCodePoint) ? numPacketsToSend : numPacketsToSend - expectedMarkedOrDroppedPacketCount; + // Because of the test setup, Ebro, Yuba, and G202X might forward + // one packet fewer and drop one packet more. Accept that as well + // as the exact expected forward count. + uint64_t kMinOutPackets = kExpectedOutPackets; + switch (asic->getAsicType()) { + case cfg::AsicType::ASIC_TYPE_EBRO: + case cfg::AsicType::ASIC_TYPE_YUBA: + case cfg::AsicType::ASIC_TYPE_G202X: + if (!isEct(ecnCodePoint) && kExpectedOutPackets > 0) { + kMinOutPackets = kExpectedOutPackets - 1; + } + break; + default: + break; + } bool useQueueStatsForAqm = asic->getSwitchType() == cfg::SwitchType::VOQ; WITH_RETRIES_N_TIMED(10, std::chrono::milliseconds(1000), { @@ -607,7 +622,7 @@ class AgentAqmTest : public AgentHwTest { // - In case of ECN, ensure that ECN marked packet count is >= the // expected marked packet count, this will ensure test case // waiting long enough to for all marked packets to be seen. - EXPECT_EVENTUALLY_GE(outPackets, kExpectedOutPackets); + EXPECT_EVENTUALLY_GE(outPackets, kMinOutPackets); if (isEct(ecnCodePoint)) { EXPECT_EVENTUALLY_GE( ecnMarking + markedCountBoundaryTolerance, @@ -628,7 +643,7 @@ class AgentAqmTest : public AgentHwTest { // Might see more outPackets than expected due to // utility::sendPacketsWithQueueBuildup() - EXPECT_GE(deltaOutPackets, kExpectedOutPackets); + EXPECT_GE(deltaOutPackets, kMinOutPackets); XLOG(DBG0) << "Delta out pkts: " << deltaOutPackets; if (verifyPacketCountFn.has_value()) {