[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH xenvif 7/8] Don't force event channel unmasking
The effect of efbe65aa "Make use of possible XENBUS_EVTCHN Unmask failure" was lost when the poller subsystem was reverted. This patch re-instates equivalent functionality. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/receiver.c | 38 +++++++++++++++++++++++++------------- src/xenvif/transmitter.c | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 5353294..9c69b77 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -1975,19 +1975,22 @@ __ReceiverRingQueuePacket( } while (InterlockedCompareExchangePointer(&Ring->PacketQueue, (PVOID)New, (PVOID)Old) != Old); } -static DECLSPEC_NOINLINE VOID +static DECLSPEC_NOINLINE ULONG ReceiverRingPoll( IN PXENVIF_RECEIVER_RING Ring ) { PXENVIF_RECEIVER Receiver; PXENVIF_FRONTEND Frontend; + ULONG Count; Receiver = Ring->Receiver; Frontend = Receiver->Frontend; + Count = 0; + if (!Ring->Enabled) - return; + goto done; for (;;) { BOOLEAN Error; @@ -2044,6 +2047,7 @@ ReceiverRingPoll( rsp_cons++; Ring->ResponsesProcessed++; + Count++; ASSERT3U(id, <=, XENVIF_RECEIVER_MAXIMUM_FRAGMENT_ID); Fragment = Ring->Pending[id]; @@ -2216,25 +2220,29 @@ ReceiverRingPoll( if (Ring->PacketQueue != NULL && KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL)) Ring->QueueDpcs++; + +done: + return Count; } -static FORCEINLINE VOID +static FORCEINLINE BOOLEAN __ReceiverRingUnmask( - IN PXENVIF_RECEIVER_RING Ring + IN PXENVIF_RECEIVER_RING Ring, + IN BOOLEAN Force ) { PXENVIF_RECEIVER Receiver; if (!Ring->Connected) - return; + return TRUE; Receiver = Ring->Receiver; - XENBUS_EVTCHN(Unmask, - &Receiver->EvtchnInterface, - Ring->Channel, - FALSE, - TRUE); + return !XENBUS_EVTCHN(Unmask, + &Receiver->EvtchnInterface, + Ring->Channel, + FALSE, + Force); } __drv_functionClass(KDEFERRED_ROUTINE) @@ -2251,6 +2259,7 @@ ReceiverRingPollDpc( ) { PXENVIF_RECEIVER_RING Ring = Context; + ULONG Count; UNREFERENCED_PARAMETER(Dpc); UNREFERENCED_PARAMETER(Argument1); @@ -2258,13 +2267,16 @@ ReceiverRingPollDpc( ASSERT(Ring != NULL); + Count = 0; + for (;;) { __ReceiverRingAcquireLock(Ring); - ReceiverRingPoll(Ring); + Count += ReceiverRingPoll(Ring); __ReceiverRingReleaseLock(Ring); - __ReceiverRingUnmask(Ring); - break; + if (__ReceiverRingUnmask(Ring, + (Count > XENVIF_RECEIVER_RING_SIZE))) + break; } } diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index 5e53f9a..34028e7 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -2614,19 +2614,22 @@ done: Ring->PacketsCompleted++; } -static DECLSPEC_NOINLINE VOID +static DECLSPEC_NOINLINE ULONG TransmitterRingPoll( IN PXENVIF_TRANSMITTER_RING Ring ) { PXENVIF_TRANSMITTER Transmitter; PXENVIF_FRONTEND Frontend; + ULONG Count; Transmitter = Ring->Transmitter; Frontend = Transmitter->Frontend; + Count = 0; + if (!Ring->Enabled) - return; + goto done; for (;;) { RING_IDX rsp_prod; @@ -2660,6 +2663,7 @@ TransmitterRingPoll( rsp = RING_GET_RESPONSE(&Ring->Front, rsp_cons); rsp_cons++; Ring->ResponsesProcessed++; + Count++; Ring->Stopped = FALSE; @@ -2785,6 +2789,9 @@ TransmitterRingPoll( Ring->Front.rsp_cons = rsp_cons; } + +done: + return Count; } static FORCEINLINE VOID @@ -2941,7 +2948,7 @@ TransmitterRingSchedule( if (Ring->Stopped) { if (!Polled) { - (VOID) TransmitterRingPoll(Ring); + TransmitterRingPoll(Ring); Polled = TRUE; } @@ -3212,9 +3219,10 @@ TransmitterRingReleaseLock( __TransmitterRingReleaseLock(Ring); } -static FORCEINLINE VOID +static FORCEINLINE BOOLEAN __TransmitterRingUnmask( - IN PXENVIF_TRANSMITTER_RING Ring + IN PXENVIF_TRANSMITTER_RING Ring, + IN BOOLEAN Force ) { PXENVIF_TRANSMITTER Transmitter; @@ -3224,13 +3232,13 @@ __TransmitterRingUnmask( Frontend = Transmitter->Frontend; if (!Ring->Connected || !FrontendIsSplit(Frontend)) - return; + return TRUE; - XENBUS_EVTCHN(Unmask, - &Transmitter->EvtchnInterface, - Ring->Channel, - FALSE, - TRUE); + return !XENBUS_EVTCHN(Unmask, + &Transmitter->EvtchnInterface, + Ring->Channel, + FALSE, + Force); } __drv_functionClass(KDEFERRED_ROUTINE) @@ -3247,6 +3255,7 @@ TransmitterRingPollDpc( ) { PXENVIF_TRANSMITTER_RING Ring = Context; + ULONG Count; UNREFERENCED_PARAMETER(Dpc); UNREFERENCED_PARAMETER(Argument1); @@ -3254,13 +3263,16 @@ TransmitterRingPollDpc( ASSERT(Ring != NULL); + Count = 0; + for (;;) { __TransmitterRingAcquireLock(Ring); - TransmitterRingPoll(Ring); + Count += TransmitterRingPoll(Ring); __TransmitterRingReleaseLock(Ring); - __TransmitterRingUnmask(Ring); - break; + if (__TransmitterRingUnmask(Ring, + (Count > XENVIF_TRANSMITTER_RING_SIZE))) + break; } } -- 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 |