Skip to content

Commit

Permalink
LB support for SecNetPerf (#3701)
Browse files Browse the repository at this point in the history
  • Loading branch information
liorze committed Jun 13, 2023
1 parent d219aee commit b1a2e05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/perf/lib/PerfServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,29 @@ PerfServer::Init(
TryGetValue(argc, argv, "stats", &PrintStats);

const char* LocalAddress = nullptr;
uint16_t Port = 0;
if (TryGetValue(argc, argv, "bind", &LocalAddress)) {
if (!ConvertArgToAddress(LocalAddress, PERF_DEFAULT_PORT, &LocalAddr)) {
WriteOutput("Failed to decode IP address: '%s'!\nMust be *, a IPv4 or a IPv6 address.\n", LocalAddress);
return QUIC_STATUS_INVALID_PARAMETER;
}
} else if (TryGetValue(argc, argv, "port", &Port)) {
QuicAddrSetPort(&LocalAddr, Port);
}

uint16_t ServerId = 0;
if (TryGetValue(argc, argv, "serverid", &ServerId)) {
QUIC_GLOBAL_SETTINGS GlobalSettings = {0};
GlobalSettings.FixedServerID = ServerId;
GlobalSettings.IsSet.FixedServerID = true;
GlobalSettings.LoadBalancingMode = QUIC_LOAD_BALANCING_SERVER_ID_FIXED;
GlobalSettings.IsSet.LoadBalancingMode = true;

QUIC_STATUS Status;
if (QUIC_FAILED(Status = MsQuic->SetParam(NULL, QUIC_PARAM_GLOBAL_GLOBAL_SETTINGS, sizeof(GlobalSettings), &GlobalSettings))) {
WriteOutput("Failed to set global settings %d\n", Status);
return Status;
}
}

const char* CibirBytes = nullptr;
Expand Down
5 changes: 4 additions & 1 deletion src/perf/lib/SecNetPerfMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ PrintHelp(
"Server: secnetperf [options]\n"
"\n"
" -bind:<addr> A local IP address to bind to.\n"
" -port:<####> The UDP port of the server. Ignored if \"bind\" is passed. (def:%u)\n"
" -serverid:<####> The ID of the server (used for load balancing).\n"
" -cibir:<hex_bytes> A CIBIR well-known idenfitier.\n"
"\n"
"Client: secnetperf -TestName:<Throughput|RPS|HPS> [options]\n"
Expand All @@ -107,7 +109,8 @@ PrintHelp(
" -qtip:<0/1> Enables/disables Quic over TCP support. (def:0)\n"
" -rio:<0/1> Enables/disables RIO support. (def:0)\n"
#endif // _KERNEL_MODE
"\n"
"\n",
PERF_DEFAULT_PORT
);
}

Expand Down

0 comments on commit b1a2e05

Please sign in to comment.