Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global internal param to get default datapath worker pool #4535

Merged
merged 4 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/core/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,24 @@
Status = QUIC_STATUS_SUCCESS;
break;

case QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL:

if (*BufferLength != sizeof(CXPLAT_WORKER_POOL*)) {
*BufferLength = sizeof(CXPLAT_WORKER_POOL*);
Status = QUIC_STATUS_BUFFER_TOO_SMALL;
break;
}

if (Buffer == NULL) {
Status = QUIC_STATUS_INVALID_PARAMETER;
break;

Check warning on line 1435 in src/core/library.c

View check run for this annotation

Codecov / codecov/patch

src/core/library.c#L1434-L1435

Added lines #L1434 - L1435 were not covered by tests
}

*(CXPLAT_WORKER_POOL**)Buffer = &MsQuicLib.WorkerPool;

Status = QUIC_STATUS_SUCCESS;
break;

default:
Status = QUIC_STATUS_INVALID_PARAMETER;
break;
Expand Down
1 change: 1 addition & 0 deletions src/inc/msquicp.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ typedef struct QUIC_PRIVATE_TRANSPORT_PARAMETER {
#endif
#define QUIC_PARAM_GLOBAL_IN_USE 0x81000004 // BOOLEAN
#define QUIC_PARAM_GLOBAL_DATAPATH_FEATURES 0x81000005 // uint32_t
#define QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL 0x81000006 // CXPLAT_WORKER_POOL*

//
// The different private parameters for Configuration.
Expand Down
46 changes: 46 additions & 0 deletions src/test/lib/ApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2681,6 +2681,52 @@ void QuicTestGlobalParam()
}
}

#if DEBUG
//
// QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL
nibanks marked this conversation as resolved.
Show resolved Hide resolved
//
{
TestScopeLogger LogScope0("QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL");
{
TestScopeLogger LogScope1("SetParam");
//
// Invalid features
//
{
TestScopeLogger LogScope2("SetParam is not allowed");
TEST_QUIC_STATUS(
QUIC_STATUS_INVALID_PARAMETER,
MsQuic->SetParam(
nullptr,
QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL,
0,
nullptr));
}
}

{
TestScopeLogger LogScope2("GetParam. Failed by missing MsQuicLib.WorkerPool");
uint32_t Length = 0;
TEST_QUIC_STATUS(
QUIC_STATUS_BUFFER_TOO_SMALL,
MsQuic->GetParam(
nullptr,
QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL,
&Length,
nullptr));
TEST_EQUAL(Length, sizeof(CXPLAT_WORKER_POOL*));

CXPLAT_WORKER_POOL* WorkerPool = 0;
TEST_QUIC_SUCCEEDED(
MsQuic->GetParam(
nullptr,
QUIC_PARAM_GLOBAL_PLATFORM_WORKER_POOL,
&Length,
&WorkerPool));
}
}
#endif

//
// Invalid parameter
//
Expand Down
Loading