Skip to content

Commit

Permalink
remove ZwSetInformationFile from CxPlatXdpExecute
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-GS committed Dec 11, 2024
1 parent 2766546 commit 33fcea4
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions src/platform/datapath_raw_xdp_wincommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,27 @@ CxPlatDpRawInterfaceInitialize(
goto Error;
}
#else
{
IO_STATUS_BLOCK IoStatusBlock;

CxPlatZeroMemory(
&Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped,
sizeof(Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped));
if (S_OK !=
(Status = ZwSetInformationFile(
(HANDLE)Queue->RxXsk,
// (IO_STATUS_BLOCK*)&Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped,
&IoStatusBlock,
&IoCompletion,
sizeof(IoCompletion),
FileIoCompletionNotificationInformation))) {

This comment has been minimized.

Copy link
@mtfriesen

mtfriesen Dec 11, 2024

Contributor

Needs to be publicly documented

QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
Status,
"ZwSetInformationFile");
}
}
#endif

//
Expand Down Expand Up @@ -678,9 +696,27 @@ CxPlatDpRawInterfaceInitialize(
goto Error;
}
#else
{
IO_STATUS_BLOCK IoStatusBlock;

CxPlatZeroMemory(
&Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped,
sizeof(Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped));
if (S_OK !=
(Status = ZwSetInformationFile(
(HANDLE)Queue->TxXsk,
&IoStatusBlock,
// (IO_STATUS_BLOCK*)&Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped,
&IoCompletion,
sizeof(IoCompletion),
FileIoCompletionNotificationInformation))) {
QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
Status,
"ZwSetInformationFile");
}
}
#endif
}

Expand Down Expand Up @@ -1491,11 +1527,6 @@ CxPlatXdpExecute(
Queue = Queue->Next;
}

#ifdef _KERNEL_MODE
HRESULT hr;
FILE_IO_COMPLETION_NOTIFICATION_INFORMATION IoCompletion = {0};
IoCompletion.Flags = FILE_SKIP_COMPLETION_PORT_ON_SUCCESS | FILE_SKIP_SET_EVENT_ON_HANDLE;
#endif
if (DidWork) {
Partition->Ec.Ready = TRUE;
State->NoWorkCount = 0;
Expand All @@ -1509,29 +1540,13 @@ CxPlatXdpExecute(
XdpQueueAsyncIoRx,
"[ xdp][%p] XDP async IO start (RX)",
Queue);
#ifdef _KERNEL_MODE
if (S_OK !=
(hr = ZwSetInformationFile(
(HANDLE)Queue->RxXsk,
(IO_STATUS_BLOCK*)&Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped,
&IoCompletion,
sizeof(IoCompletion),
FileIoCompletionNotificationInformation))) {
QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
hr,
"ZwSetInformationFile");
}
#else
CxPlatZeroMemory(
&Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped,
sizeof(Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped));
HRESULT hr =
XskNotifyAsync(
Queue->RxXsk, XSK_NOTIFY_FLAG_WAIT_RX,
&Queue->RxIoSqe.DatapathSqe.Sqe.Overlapped);
#endif
if (hr == HRESULT_FROM_WIN32(ERROR_IO_PENDING)) {
Queue->RxQueued = TRUE;
} else if (hr == S_OK) {
Expand All @@ -1549,29 +1564,13 @@ CxPlatXdpExecute(
XdpQueueAsyncIoTx,
"[ xdp][%p] XDP async IO start (TX)",
Queue);
#ifdef _KERNEL_MODE
if (S_OK !=
(hr = ZwSetInformationFile(
(HANDLE)Queue->TxXsk,
(IO_STATUS_BLOCK*)&Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped,
&IoCompletion,
sizeof(IoCompletion),
FileIoCompletionNotificationInformation))) {
QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
hr,
"ZwSetInformationFile");
}
#else
CxPlatZeroMemory(
&Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped,
sizeof(Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped));
HRESULT hr =
XskNotifyAsync(
Queue->TxXsk, XSK_NOTIFY_FLAG_WAIT_TX,
&Queue->TxIoSqe.DatapathSqe.Sqe.Overlapped);
#endif
if (hr == HRESULT_FROM_WIN32(ERROR_IO_PENDING)) {
Queue->TxQueued = TRUE;
} else if (hr == S_OK) {
Expand Down

0 comments on commit 33fcea4

Please sign in to comment.