Skip to content
12 changes: 8 additions & 4 deletions src/xdplwf/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ XdpGenericCleanupInterface(
XdpDeregisterInterface(Generic->Registration);
Generic->Registration = NULL;
}

XdpPktMonUntrackInterface(Generic);
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand Down Expand Up @@ -665,6 +667,7 @@ XdpGenericAttachInterface(
KeInitializeEvent(&Generic->Tx.Datapath.ReadyEvent, NotificationEvent, FALSE);
KeInitializeEvent(&Generic->Rx.Datapath.ReadyEvent, NotificationEvent, FALSE);
XdpInitializeReferenceCount(&Generic->ReferenceCount);
XdpPktMonInitializeInterface(Generic);
Generic->Filter = Filter;
Generic->NdisFilterHandle = NdisFilterHandle;
Generic->IfIndex = IfIndex;
Expand Down Expand Up @@ -693,6 +696,11 @@ XdpGenericAttachInterface(
goto Exit;
}

Status = XdpPktMonTrackInterface(Generic);
if (!NT_SUCCESS(Status)) {
goto Exit;
}

Status =
XdpInitializeCapabilities(
&Generic->Capabilities, &DriverApiVersion);
Expand All @@ -714,8 +722,6 @@ XdpGenericAttachInterface(
goto Exit;
}

XdpPktMonRegisterInterface(&Generic->PktMonContext, Generic->IfIndex);

RtlZeroMemory(AddIf, sizeof(*AddIf));
AddIf->InterfaceCapabilities = &Generic->InternalCapabilities;
AddIf->RemoveInterfaceComplete = XdpGenericRemoveInterfaceComplete;
Expand Down Expand Up @@ -747,8 +753,6 @@ XdpGenericDetachInterface(
//
XdpIfRemoveInterfaces(&Generic->XdpIfInterfaceHandle, 1);
}

XdpPktMonUnregisterInterface(&Generic->PktMonContext);
}

VOID
Expand Down
8 changes: 7 additions & 1 deletion src/xdplwf/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ typedef struct _XDP_LWF_GENERIC {
} Tx;

//
// Protected by NDIS driver stack synchronization.
// Pktmon context. Protected by the pktmon rundown reference.
//
XDP_INTERFACE_PKTMON_CONTEXT *PktMonContext;
PEX_RUNDOWN_REF_CACHE_AWARE PktMonRundownRef;

//
// Pktmon generic list entry. Protected by the pktmon generic list lock.
//
LIST_ENTRY PktMonLink;
} XDP_LWF_GENERIC;

typedef enum _XDP_LWF_GENERIC_INJECTION_TYPE {
Expand Down
Loading
Loading