Skip to content

Commit

Permalink
Add apis for 2-stage voq configs for eventor, cpu, rcy and mgmt ports
Browse files Browse the repository at this point in the history
Summary: As titled

Reviewed By: zechengh09

Differential Revision:
D66043279

Privacy Context Container: L1125642

fbshipit-source-id: 5e242419f6da53755d309e9696411625ff3620e5
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Nov 16, 2024
1 parent 6e22b86 commit 998c05a
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions fboss/agent/test/utils/VoqTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,49 @@ std::vector<cfg::PortQueue> getDefaultNifVoqCfg() {
ncQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(ncQueue);
}
return voqs;
}

std::vector<cfg::PortQueue> get2VoqCfg() {
std::vector<cfg::PortQueue> voqs;
cfg::PortQueue lowQueue;
lowQueue.id() = 0;
lowQueue.name() = "low";
lowQueue.streamType() = cfg::StreamType::UNICAST;
lowQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(lowQueue);

cfg::PortQueue highQueue;
highQueue.id() = 1;
highQueue.name() = "high";
highQueue.streamType() = cfg::StreamType::UNICAST;
highQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(highQueue);
return voqs;
}

std::vector<cfg::PortQueue> get3VoqCfg() {
std::vector<cfg::PortQueue> voqs;
cfg::PortQueue lowQueue;
lowQueue.id() = 0;
lowQueue.name() = "low";
lowQueue.streamType() = cfg::StreamType::UNICAST;
lowQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(lowQueue);

cfg::PortQueue midQueue;
midQueue.id() = 1;
midQueue.name() = "mid";
midQueue.streamType() = cfg::StreamType::UNICAST;
midQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(midQueue);

cfg::PortQueue highQueue;
highQueue.id() = 2;
highQueue.name() = "high";
highQueue.streamType() = cfg::StreamType::UNICAST;
highQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(highQueue);
return voqs;
}
} // namespace
Expand Down Expand Up @@ -389,15 +431,21 @@ std::optional<QueueConfigAndName> getNameAndDefaultVoqCfg(
case cfg::PortType::INTERFACE_PORT:
return QueueConfigAndName{"defaultVoqCofig", getDefaultNifVoqCfg()};
case cfg::PortType::CPU_PORT:
if (isDualStage3Q2QMode()) {
return QueueConfigAndName{"3VoqConfig", get3VoqCfg()};
}
break;
case cfg::PortType::MANAGEMENT_PORT:
case cfg::PortType::RECYCLE_PORT:
case cfg::PortType::EVENTOR_PORT:
XLOG(FATAL) << " TODO";
if (isDualStage3Q2QMode()) {
return QueueConfigAndName{"2VoqConfig", get2VoqCfg()};
}
break;
case cfg::PortType::FABRIC_PORT:
XLOG(FATAL) << " No VOQ configs for fabric ports";
break;
}
throw FbossError("Unsupported port type: ", portType);
return std::nullopt;
}
} // namespace facebook::fboss::utility

0 comments on commit 998c05a

Please sign in to comment.