Skip to content

Commit

Permalink
Specialize voq nif port config based on dual state 2q/3q feature or not
Browse files Browse the repository at this point in the history
Summary: As titled

Reviewed By: daiwei1983

Differential Revision:
D66035994

Privacy Context Container: L1125642

fbshipit-source-id: c434f8570866090ab03dc8170cd32958efda909a
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Nov 16, 2024
1 parent 74f09a8 commit d292f90
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 27 deletions.
1 change: 1 addition & 0 deletions fboss/agent/test/utils/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ cpp_library(
"VoqTestUtils.h",
],
exported_deps = [
"//fboss/agent:agent_features",
"//fboss/agent:core",
"//fboss/agent:fboss-types",
"//fboss/agent:switch_config-cpp2-types",
Expand Down
77 changes: 50 additions & 27 deletions fboss/agent/test/utils/VoqTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "fboss/agent/test/utils/VoqTestUtils.h"
#include "fboss/agent/AgentFeatures.h"
#include "fboss/agent/DsfStateUpdaterUtil.h"
#include "fboss/agent/SwSwitch.h"
#include "fboss/agent/test/TestEnsembleIf.h"
Expand Down Expand Up @@ -328,34 +329,56 @@ void setupRemoteIntfAndSysPorts(SwSwitch* swSwitch, bool useEncapIndex) {

std::vector<cfg::PortQueue> getDefaultNifVoqCfg() {
std::vector<cfg::PortQueue> voqs;
if (isDualStage3Q2QMode()) {
cfg::PortQueue rdmaQueue;
rdmaQueue.id() = 0;
rdmaQueue.name() = "rdma";
rdmaQueue.streamType() = cfg::StreamType::UNICAST;
rdmaQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(rdmaQueue);

cfg::PortQueue defaultQueue;
defaultQueue.id() = 0;
defaultQueue.name() = "default";
defaultQueue.streamType() = cfg::StreamType::UNICAST;
defaultQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(defaultQueue);

cfg::PortQueue rdmaQueue;
rdmaQueue.id() = 2;
rdmaQueue.name() = "rdma";
rdmaQueue.streamType() = cfg::StreamType::UNICAST;
rdmaQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(rdmaQueue);

cfg::PortQueue monitoringQueue;
monitoringQueue.id() = 6;
monitoringQueue.name() = "monitoring";
monitoringQueue.streamType() = cfg::StreamType::UNICAST;
monitoringQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(monitoringQueue);

cfg::PortQueue ncQueue;
ncQueue.id() = 7;
ncQueue.name() = "nc";
ncQueue.streamType() = cfg::StreamType::UNICAST;
ncQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(ncQueue);
cfg::PortQueue monitoringQueue;
monitoringQueue.id() = 1;
monitoringQueue.name() = "monitoring";
monitoringQueue.streamType() = cfg::StreamType::UNICAST;
monitoringQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(monitoringQueue);

cfg::PortQueue ncQueue;
ncQueue.id() = 2;
ncQueue.name() = "nc";
ncQueue.streamType() = cfg::StreamType::UNICAST;
ncQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(ncQueue);
} else {
cfg::PortQueue defaultQueue;
defaultQueue.id() = 0;
defaultQueue.name() = "default";
defaultQueue.streamType() = cfg::StreamType::UNICAST;
defaultQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(defaultQueue);

cfg::PortQueue rdmaQueue;
rdmaQueue.id() = 2;
rdmaQueue.name() = "rdma";
rdmaQueue.streamType() = cfg::StreamType::UNICAST;
rdmaQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(rdmaQueue);

cfg::PortQueue monitoringQueue;
monitoringQueue.id() = 6;
monitoringQueue.name() = "monitoring";
monitoringQueue.streamType() = cfg::StreamType::UNICAST;
monitoringQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(monitoringQueue);

cfg::PortQueue ncQueue;
ncQueue.id() = 7;
ncQueue.name() = "nc";
ncQueue.streamType() = cfg::StreamType::UNICAST;
ncQueue.scheduling() = cfg::QueueScheduling::INTERNAL;
voqs.push_back(ncQueue);
}

return voqs;
}
Expand Down

0 comments on commit d292f90

Please sign in to comment.