Skip to content

Commit

Permalink
Improve offload synchronization (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfriesen authored May 12, 2023
1 parent b866434 commit 517c232
Show file tree
Hide file tree
Showing 10 changed files with 648 additions and 416 deletions.
12 changes: 0 additions & 12 deletions published/private/xdpif.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,6 @@ XDP_SET_INTERFACE_OFFLOAD(
_Out_opt_ UINT32 *OffloadResultWritten
);

//
// References the current state of an offload on an interface. This ensures the
// current state of that offload doesn't change.
//
typedef
NTSTATUS
XDP_REFERENCE_INTERFACE_OFFLOAD(
_In_ VOID *InterfaceOffloadHandle,
_In_ XDP_INTERFACE_OFFLOAD_TYPE OffloadType
);

//
// Close an interface offload configuration handle.
// This reverts any offload configuration done or references added via the
Expand All @@ -281,7 +270,6 @@ typedef struct _XDP_OFFLOAD_DISPATCH {
XDP_GET_INTERFACE_OFFLOAD_CAPABILITIES *GetInterfaceOffloadCapabilities;
XDP_GET_INTERFACE_OFFLOAD *GetInterfaceOffload;
XDP_SET_INTERFACE_OFFLOAD *SetInterfaceOffload;
XDP_REFERENCE_INTERFACE_OFFLOAD *ReferenceInterfaceOffload;
XDP_CLOSE_INTERFACE_OFFLOAD_HANDLE *CloseInterfaceOffloadHandle;
} XDP_OFFLOAD_DISPATCH;

Expand Down
14 changes: 0 additions & 14 deletions src/xdp/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,20 +779,6 @@ XdpIfSetInterfaceOffload(
OffloadResultSize, OffloadResultWritten);
}

NTSTATUS
XdpIfReferenceInterfaceOffload(
_In_ XDP_IFSET_HANDLE IfSetHandle,
_In_ VOID *InterfaceOffloadHandle,
_In_ XDP_INTERFACE_OFFLOAD_TYPE OffloadType
)
{
XDP_INTERFACE_SET *IfSet = (XDP_INTERFACE_SET *)IfSetHandle;

return
IfSet->OffloadDispatch->ReferenceInterfaceOffload(
InterfaceOffloadHandle, OffloadType);
}

static
VOID
XdpIfpStartRundown(
Expand Down
7 changes: 0 additions & 7 deletions src/xdp/bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ XdpIfSetInterfaceOffload(
_Out_opt_ UINT32 *OffloadResultWritten
);

NTSTATUS
XdpIfReferenceInterfaceOffload(
_In_ XDP_IFSET_HANDLE IfSetHandle,
_In_ VOID *InterfaceOffloadHandle,
_In_ XDP_INTERFACE_OFFLOAD_TYPE OffloadType
);

//
// The following routines must be invoked from the serialized work queue.
//
Expand Down
2 changes: 2 additions & 0 deletions src/xdp/inc/xdptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
// CUSTOM_TYPE(TX_QUEUE_NOTIFICATION_TYPE, ItemEnum(_XDP_TX_QUEUE_NOTIFICATION_TYPE));
// CUSTOM_TYPE(XDP_MODE, ItemEnum(_XDP_INTERFACE_MODE));
// CUSTOM_TYPE(REDIRECT_TARGET_TYPE, ItemEnum(_XDP_REDIRECT_TARGET_TYPE));
// CUSTOM_TYPE(OID_REQUEST_INTERFACE, ItemEnum(_XDP_OID_REQUEST_INTERFACE));
// CUSTOM_TYPE(OID_ACTION, ItemEnum(_XDP_OID_ACTION));
//
// DEFINE_CPLX_TYPE(HEXDUMP, WPP_LOGHEXDUMP, WPP_HEXDUMP, ItemHEXDump, "s", _HEX_, 0, 2);
// DEFINE_CPLX_TYPE(IPV6ADDR, WPP_LOGIPV6, CONST UCHAR *, ItemIPV6Addr, "s", _IPV6_, 0);
Expand Down
8 changes: 6 additions & 2 deletions src/xdplwf/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ XdpLwfDereferenceFilter(
)
{
if (XdpDecrementReferenceCount(&Filter->ReferenceCount)) {
XdpLwfOffloadUnInitialize(Filter);
ExFreePoolWithTag(Filter, POOLTAG_FILTER);
}
}
Expand Down Expand Up @@ -182,6 +183,11 @@ XdpLwfFilterAttach(
goto Exit;
}

Status = XdpLwfOffloadStart(Filter);
if (!NT_SUCCESS(Status)) {
goto Exit;
}

Status =
XdpIfCreateInterfaceSet(
Filter->MiniportIfIndex, &XdpLwfOffloadDispatch, Filter,
Expand Down Expand Up @@ -339,8 +345,6 @@ XdpLwfFilterDetach(
Filter->OidWorker = NULL;
}

XdpLwfOffloadUnInitialize(Filter);

Filter->NdisFilterHandle = NULL;

XdpLwfDereferenceFilter(Filter);
Expand Down
Loading

0 comments on commit 517c232

Please sign in to comment.