Skip to content
Open
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
92cb8a8
Kernel Platform Worker Support
nibanks Oct 9, 2024
3b8a0b6
more SAL
nibanks Oct 9, 2024
265ab8e
Fixes
nibanks Oct 9, 2024
1f47cd4
minor refactor
nibanks Oct 9, 2024
47505ab
Start the worker pool
nibanks Oct 10, 2024
a10451c
Merge branch 'main' into nibanks/kernel-platform-worker
nibanks Nov 3, 2024
7d7e3f2
Remove extra variable
nibanks Nov 3, 2024
b332a71
merge winkernel and dummy datapath
ami-GS Nov 11, 2024
91d4cc1
fix
ami-GS Nov 11, 2024
22924dd
flag to identify datapath
ami-GS Nov 11, 2024
866179e
Merge branch 'main' into dev/daiki/winkernel_merging
ami-GS Nov 12, 2024
7cdc727
trailing newline
ami-GS Nov 12, 2024
e186b59
Merge branch 'main' into nibanks/kernel-platform-worker
nibanks Nov 13, 2024
3569672
Merge branch 'nibanks/kernel-platform-worker' of https://github.com/m…
nibanks Nov 13, 2024
56c8ce0
Merge branch 'main' into dev/daiki/winkernel_merging
ami-GS Nov 14, 2024
84593b2
use common members
ami-GS Nov 14, 2024
1a363f1
cleanup
ami-GS Nov 19, 2024
75cfc74
change dp type naming
ami-GS Nov 19, 2024
70fdaca
fix type and refactoring
ami-GS Nov 19, 2024
d67a79b
fix
ami-GS Nov 19, 2024
ca42af4
assemble definition in same ifdef
ami-GS Nov 20, 2024
93cda23
try using latest xdp
ami-GS Nov 12, 2024
8d627d6
build
ami-GS Nov 12, 2024
aba07ac
adjust newer xdp api restriction
ami-GS Nov 12, 2024
70ff428
remove XDP_ASSERT_INTERNAL
ami-GS Nov 13, 2024
7fe7903
build with placeholders
ami-GS Nov 13, 2024
a127407
use named branch
ami-GS Nov 13, 2024
ac86872
update xdp-for-windows directly
ami-GS Nov 14, 2024
a8a81e1
move macro definition to code
ami-GS Nov 14, 2024
b89d1db
install built xdp
ami-GS Nov 14, 2024
83b37b1
download prerelease
ami-GS Nov 14, 2024
2f1dac7
signing
ami-GS Nov 14, 2024
37a4f13
tmp
ami-GS Nov 20, 2024
58c1a6f
FIX?
ami-GS Nov 21, 2024
507f020
ending by newline
ami-GS Nov 22, 2024
b375145
Merge branch 'dev/daiki/winkernel_merging' into dev/daiki/winkernel_m…
ami-GS Nov 22, 2024
e16934d
kernel build fix
ami-GS Nov 25, 2024
b1b8402
enable XDP for kernel
ami-GS Nov 25, 2024
ba3423c
Merge branch 'main' into dev/daiki/winkernel_merging_exp
ami-GS Nov 25, 2024
99a9aac
update clog
ami-GS Nov 26, 2024
32d778f
fix several access violation
ami-GS Nov 27, 2024
f277b67
Merge branch 'main' into dev/daiki/winkernel_merging_exp
ami-GS Nov 27, 2024
f6bc45c
Merge branch 'nibanks/kernel-platform-worker' into dev/daiki/winkerne…
ami-GS Nov 27, 2024
6c1b53c
unify datapath_raw_winXXX
ami-GS Nov 27, 2024
fd92152
add logging
ami-GS Nov 28, 2024
b906cbe
Set Rx event. experimental
ami-GS Dec 10, 2024
107fb42
Merge branch 'main' into dev/daiki/winkernel_merging_exp
ami-GS Dec 10, 2024
05ca68f
rmeove macro
ami-GS Dec 10, 2024
2766546
fix usermode build
ami-GS Dec 10, 2024
33fcea4
remove ZwSetInformationFile from CxPlatXdpExecute
ami-GS Dec 11, 2024
e4c8271
fix interface init phase with proper flag and error code
ami-GS Dec 13, 2024
6cd0fee
make status code valid for both user/kernel
ami-GS Dec 13, 2024
3243f6d
Merge branch 'main' into nibanks/kernel-platform-worker
ami-GS Jan 14, 2025
484a446
Use Nt APIs
ami-GS Jan 14, 2025
51ef7bc
Update src/inc/quic_platform_winkernel.h
ami-GS Jan 15, 2025
79b9004
Update src/inc/quic_platform_winkernel.h
ami-GS Jan 15, 2025
c02e738
Update src/inc/quic_platform_winkernel.h
ami-GS Jan 15, 2025
09f2fbf
fix comment
ami-GS Jan 15, 2025
c4a8f36
write IO completion API placeholders
ami-GS Jan 15, 2025
1f23c09
link ntdll for Nt*IoCompletion APIs
ami-GS Jan 15, 2025
fd58cee
sync annotation
ami-GS Jan 15, 2025
1f9c6e9
Use Zw version API
ami-GS Jan 16, 2025
101f6b9
fix as proposed
ami-GS Jan 16, 2025
a7def7a
use InitializeObjectAttributes
ami-GS Jan 21, 2025
2d547c6
workaround to use completion port under DISPATCH_LEVEL
ami-GS Jan 29, 2025
fc6b308
Update src/inc/quic_platform_winkernel.h
ami-GS Jan 31, 2025
c364a7a
cleanup
ami-GS Jan 31, 2025
75579e2
Merge branch 'main' into nibanks/kernel-platform-worker
nibanks Feb 13, 2025
b7795f5
cleanup
nibanks Feb 13, 2025
8132f01
refactor
nibanks Feb 13, 2025
beeeffc
space
nibanks Feb 13, 2025
665315d
fix annotation
nibanks Feb 13, 2025
7c887e9
better sal
nibanks Feb 13, 2025
8cb40bd
fix sal
nibanks Feb 13, 2025
6dd2aed
per sqe minipacket; set4
nibanks Feb 13, 2025
b77cb3f
revert set4
nibanks Feb 13, 2025
565f872
Merge branch 'nibanks/kernel-platform-worker' into dev/daiki/winkerne…
nibanks Feb 13, 2025
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
Prev Previous commit
Next Next commit
Use Nt APIs
  • Loading branch information
ami-GS committed Jan 14, 2025
commit 484a4463dd5a9280c75c94182524c09be3aa30fb
146 changes: 81 additions & 65 deletions src/inc/quic_platform_winkernel.h
Original file line number Diff line number Diff line change
@@ -474,21 +474,20 @@ _CxPlatEventWaitWithTimeout(
// Event Queue Interfaces
//

typedef struct CXPLAT_EVENTQ {
CXPLAT_LOCK Lock;
LIST_ENTRY Events;
CXPLAT_EVENT EventsAvailable;
} CXPLAT_EVENTQ;

typedef struct CXPLAT_CQE {
void* UserData;
} CXPLAT_CQE;

#define CXPLAT_SQE CXPLAT_SQE
#define CXPLAT_SQE_DEFAULT {0}
typedef HANDLE CXPLAT_EVENTQ;
typedef FILE_IO_COMPLETION_INFORMATION CXPLAT_CQE;

typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
void
(CXPLAT_EVENT_COMPLETION)(
_In_ CXPLAT_CQE* Cqe
);
typedef CXPLAT_EVENT_COMPLETION *CXPLAT_EVENT_COMPLETION_HANDLER;

typedef struct CXPLAT_SQE {
LIST_ENTRY Link;
void* UserData;
CXPLAT_CQE Cqe;
CXPLAT_EVENT_COMPLETION_HANDLER Completion;
} CXPLAT_SQE;

_IRQL_requires_max_(PASSIVE_LEVEL)
@@ -498,10 +497,13 @@ CxPlatEventQInitialize(
_Out_ CXPLAT_EVENTQ* queue
)
{
CxPlatLockInitialize(&queue->Lock);
InitializeListHead(&queue->Events);
CxPlatEventInitialize(&queue->EventsAvailable, TRUE, FALSE);
return TRUE;
NTSTATUS status = NtCreateIoCompletion(
queue,
IO_COMPLETION_ALL_ACCESS,
NULL,
0
);
return NT_SUCCESS(status);
}

_IRQL_requires_max_(PASSIVE_LEVEL)
@@ -511,37 +513,19 @@ CxPlatEventQCleanup(
_In_ CXPLAT_EVENTQ* queue
)
{
CxPlatEventUninitialize(queue->EventsAvailable);
CXPLAT_DBG_ASSERT(IsListEmpty(&queue->Events));
CxPlatLockUninitialize(&queue->Lock);
NtClose(*queue);
}

_IRQL_requires_max_(PASSIVE_LEVEL)
inline
BOOLEAN

CxPlatEventQEnqueue(
_In_ CXPLAT_EVENTQ* queue,
_In_ CXPLAT_SQE* sqe
)
{
CxPlatLockAcquire(&queue->Lock);

if (sqe->Link.Flink != NULL) { // Already in a queue
CxPlatLockRelease(&queue->Lock);
return TRUE;
}

BOOLEAN SignalEvent = IsListEmpty(&queue->Events);
InsertTailList(&queue->Events, &sqe->Link);

CxPlatLockRelease(&queue->Lock);

if (SignalEvent) {
CxPlatEventSet(queue->EventsAvailable);
}

return TRUE;
NTSTATUS status = NtSetIoCompletion(*queue, NULL, sqe, STATUS_SUCCESS, 0);
return NT_SUCCESS(status);
}

_IRQL_requires_max_(PASSIVE_LEVEL)
@@ -554,33 +538,31 @@ CxPlatEventQDequeue(
_In_ uint32_t wait_time // milliseconds
)
{
CxPlatLockAcquire(&queue->Lock);

if (IsListEmpty(&queue->Events)) {
CxPlatEventClear(queue->EventsAvailable);
CxPlatLockRelease(&queue->Lock);
if (wait_time == 0) {
return 0;
}
if (wait_time == UINT32_MAX) {
CxPlatEventWaitForever(queue->EventsAvailable);
} else {
CxPlatEventWaitWithTimeout(queue->EventsAvailable, wait_time);
uint32_t EventsDequeued = 0;
LARGE_INTEGER timeout;
timeout.QuadPart = -10000 * wait_time;

while (EventsDequeued < count) {
PVOID keyContext;
PVOID apcContext;
IO_STATUS_BLOCK ioStatusBlock;

NTSTATUS status = NtRemoveIoCompletion(
*queue,
&keyContext,
&apcContext,
&ioStatusBlock,
wait_time == UINT32_MAX ? NULL : &timeout);
if (!NT_SUCCESS(status)) {
break;
}
CxPlatLockAcquire(&queue->Lock);
}

uint32_t EventsDequeued = 0;
while (EventsDequeued < count && !IsListEmpty(&queue->Events)) {
CXPLAT_SQE* Sqe =
CXPLAT_CONTAINING_RECORD(
RemoveHeadList(&queue->Events), CXPLAT_SQE, Link);
events[EventsDequeued++].UserData = Sqe->UserData;
Sqe->Link.Flink = NULL; // Indicates it's not in a queue
events[EventsDequeued].KeyContext = keyContext;
events[EventsDequeued].ApcContext = apcContext;
events[EventsDequeued].IoStatusBlock = ioStatusBlock;
EventsDequeued++;
}

CxPlatLockRelease(&queue->Lock);

return EventsDequeued;
}

@@ -597,12 +579,46 @@ CxPlatEventQReturn(
}

inline
void*
CxPlatCqeUserData(
BOOLEAN
CxPlatSqeInitialize(
_In_ CXPLAT_EVENTQ* queue,
_In_ CXPLAT_EVENT_COMPLETION_HANDLER completion,
_Out_ CXPLAT_SQE* sqe
)
{
UNREFERENCED_PARAMETER(queue);
sqe->Completion = completion;
return TRUE;
}

inline
void
CxPlatSqeInitializeEx(
_In_ CXPLAT_EVENT_COMPLETION_HANDLER completion,
_Out_ CXPLAT_SQE* sqe
)
{
sqe->Completion = completion;
}

inline
void
CxPlatSqeCleanup(
_In_ CXPLAT_EVENTQ* queue,
_In_ CXPLAT_SQE* sqe
)
{
UNREFERENCED_PARAMETER(queue);
UNREFERENCED_PARAMETER(sqe);
}

inline
CXPLAT_SQE*
CxPlatCqeGetSqe(
_In_ const CXPLAT_CQE* cqe
)
{
return cqe->UserData;
return CONTAINING_RECORD(cqe->ApcContext, CXPLAT_SQE, Cqe);
}

//
Loading
Oops, something went wrong.