Skip to content

Commit

Permalink
Fix epoll
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Jan 3, 2025
1 parent d86e76c commit 00f4574
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
24 changes: 16 additions & 8 deletions src/platform/datapath_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ typedef struct CXPLAT_RECV_MSG_CONTROL_BUFFER {
#define CXPLAT_DBG_ASSERT_CMSG(CMsg, type)
#endif

CXPLAT_EVENT_COMPLETION CxPlatSocketContextUninitializeComplete;
CXPLAT_EVENT_COMPLETION CxPlatSocketContextUninitializeEventComplete;
CXPLAT_EVENT_COMPLETION CxPlatSocketContextFlushTxEventComplete;
CXPLAT_EVENT_COMPLETION CxPlatSocketContextProcessIoCompletion;
CXPLAT_EVENT_COMPLETION CxPlatSocketContextIoEventComplete;

void
CxPlatDataPathCalculateFeatureSupport(
Expand Down Expand Up @@ -579,7 +579,7 @@ CxPlatSocketContextSqeInitialize(

if (!CxPlatSqeInitialize(
SocketContext->DatapathPartition->EventQ,
CxPlatSocketContextUninitializeComplete,
CxPlatSocketContextUninitializeEventComplete,
&SocketContext->ShutdownSqe)) {
Status = errno;
QuicTraceEvent(
Expand All @@ -594,7 +594,7 @@ CxPlatSocketContextSqeInitialize(

if (!CxPlatSqeInitialize(
SocketContext->DatapathPartition->EventQ,
CxPlatSocketContextProcessIoCompletion,
CxPlatSocketContextIoEventComplete,
&SocketContext->IoSqe)) {
Status = errno;
QuicTraceEvent(
Expand Down Expand Up @@ -1128,11 +1128,9 @@ CxPlatSocketRelease(

void
CxPlatSocketContextUninitializeComplete(
_In_ CXPLAT_CQE* Cqe
_In_ CXPLAT_SOCKET_CONTEXT* SocketContext
)
{
CXPLAT_SOCKET_CONTEXT* SocketContext =
CXPLAT_CONTAINING_RECORD(CxPlatCqeGetSqe(Cqe), CXPLAT_SOCKET_CONTEXT, ShutdownSqe);
#if DEBUG
CXPLAT_DBG_ASSERT(!SocketContext->Freed);
SocketContext->Freed = TRUE;
Expand Down Expand Up @@ -1171,6 +1169,16 @@ CxPlatSocketContextUninitializeComplete(
CxPlatSocketRelease(SocketContext->Binding);
}

void
CxPlatSocketContextUninitializeEventComplete(
_In_ CXPLAT_CQE* Cqe
)
{
CXPLAT_SOCKET_CONTEXT* SocketContext =
CXPLAT_CONTAINING_RECORD(CxPlatCqeGetSqe(Cqe), CXPLAT_SOCKET_CONTEXT, ShutdownSqe);
CxPlatSocketContextUninitializeComplete(SocketContext);
}

void
CxPlatSocketContextUninitialize(
_In_ CXPLAT_SOCKET_CONTEXT* SocketContext
Expand Down Expand Up @@ -2811,7 +2819,7 @@ CxPlatSocketGetTcpStatistics(
}

void
CxPlatSocketContextProcessIoCompletion(
CxPlatSocketContextIoEventComplete(
_In_ CXPLAT_CQE* Cqe
)
{
Expand Down
5 changes: 1 addition & 4 deletions src/platform/datapath_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ typedef struct QUIC_CACHEALIGN CXPLAT_SOCKET_CONTEXT {
//
// The event for the shutdown event.
//
DATAPATH_SQE ShutdownSqe;
CXPLAT_SQE ShutdownSqe;

//
// The user data for the IO event.
Expand Down Expand Up @@ -1011,7 +1011,6 @@ CxPlatSocketContextUninitialize(

CxPlatEventQEnqueue(
SocketContext->DatapathPartition->EventQ,
&SocketContext->ShutdownSqe.Sqe,
&SocketContext->ShutdownSqe);
}
}
Expand Down Expand Up @@ -1425,8 +1424,6 @@ CxPlatSocketCreateUdp(
for (uint32_t i = 0; i < SocketCount; i++) {
Binding->SocketContexts[i].Binding = Binding;
Binding->SocketContexts[i].SocketFd = INVALID_SOCKET;
Binding->SocketContexts[i].ShutdownSqe.CqeType = CXPLAT_CQE_TYPE_SOCKET_SHUTDOWN;
Binding->SocketContexts[i].IoCqeType = CXPLAT_CQE_TYPE_SOCKET_IO;
Binding->SocketContexts[i].RecvIov.iov_len =
Binding->Mtu - CXPLAT_MIN_IPV4_HEADER_SIZE - CXPLAT_UDP_HEADER_SIZE;
Binding->SocketContexts[i].DatapathPartition =
Expand Down

0 comments on commit 00f4574

Please sign in to comment.