[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Don't bump the receiver event counter if the poller is going to retry
There is little point in bumping rsp_event (to trigger a new event from the backend) if the poller is going to retry, so we can save modifying the shared ring in this case. This patch also adds extra debug code to the poller to make sure it never exits from the main loop until either there are no retries pending or the instance has been disabled. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/poller.c | 26 +++++++++++++++----------- src/xenvif/receiver.c | 9 +++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/xenvif/poller.c b/src/xenvif/poller.c index 6ff2c8c..cc7e68f 100644 --- a/src/xenvif/poller.c +++ b/src/xenvif/poller.c @@ -551,6 +551,9 @@ PollerInstanceDpc( PXENVIF_POLLER_INSTANCE Instance = Context; PXENVIF_POLLER Poller; PXENVIF_FRONTEND Frontend; + BOOLEAN Enabled; + BOOLEAN ReceiverRetry; + BOOLEAN TransmitterRetry; UNREFERENCED_PARAMETER(Dpc); UNREFERENCED_PARAMETER(Argument1); @@ -560,9 +563,11 @@ PollerInstanceDpc( Poller = Instance->Poller; Frontend = Poller->Frontend; + Enabled = FALSE; + ReceiverRetry = FALSE; + TransmitterRetry = FALSE; for (;;) { - BOOLEAN Enabled; BOOLEAN NeedReceiverPoll; BOOLEAN NeedTransmitterPoll; KIRQL Irql; @@ -591,14 +596,12 @@ PollerInstanceDpc( if (NeedReceiverPoll) { - BOOLEAN Retry; - KeRaiseIrql(DISPATCH_LEVEL, &Irql); - Retry = ReceiverPoll(FrontendGetReceiver(Frontend), - Instance->Index); + ReceiverRetry = ReceiverPoll(FrontendGetReceiver(Frontend), + Instance->Index); - if (!Retry) { + if (!ReceiverRetry) { PollerInstanceUnmask(Instance, XENVIF_POLLER_EVENT_RECEIVE); } else { (VOID) InterlockedBitTestAndSet(&Instance->Pending, @@ -610,14 +613,12 @@ PollerInstanceDpc( if (NeedTransmitterPoll) { - BOOLEAN Retry; - KeRaiseIrql(DISPATCH_LEVEL, &Irql); - Retry = TransmitterPoll(FrontendGetTransmitter(Frontend), - Instance->Index); + TransmitterRetry = TransmitterPoll(FrontendGetTransmitter(Frontend), + Instance->Index); - if (!Retry) { + if (!TransmitterRetry) { PollerInstanceUnmask(Instance, XENVIF_POLLER_EVENT_TRANSMIT); } else { (VOID) InterlockedBitTestAndSet(&Instance->Pending, @@ -627,6 +628,9 @@ PollerInstanceDpc( KeLowerIrql(Irql); } } + + ASSERT(!Enabled || !ReceiverRetry); + ASSERT(!Enabled || !TransmitterRetry); } static NTSTATUS diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 6f1fbe5..1f64fab 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -1959,6 +1959,9 @@ ReceiverRingPoll( TailMdl = NULL; EOP = TRUE; + if (Retry) + break; + KeMemoryBarrier(); rsp_prod = Ring->Shared->rsp_prod; @@ -1966,7 +1969,7 @@ ReceiverRingPoll( KeMemoryBarrier(); - if (rsp_cons == rsp_prod || Retry) + if (rsp_cons == rsp_prod) break; while (rsp_cons != rsp_prod && !Retry) { @@ -2153,7 +2156,9 @@ ReceiverRingPoll( KeMemoryBarrier(); Ring->Front.rsp_cons = rsp_cons; - Ring->Shared->rsp_event = rsp_cons + 1; + if (!Retry) + Ring->Shared->rsp_event = rsp_cons + 1; + } if (!__ReceiverRingIsStopped(Ring)) -- 2.5.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |