[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH xenvif 6/8] Get rid of the 'Retry' exit from the ring poll routines
This was supposed to allow better interleaving of receive and transmit polling, but this does not really seem to help so it really only makes the code more complex than it needs to be. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/receiver.c | 31 ++++++------------------------- src/xenvif/transmitter.c | 31 ++++++------------------------- 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index ed362ff..5353294 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -1975,23 +1975,19 @@ __ReceiverRingQueuePacket( } while (InterlockedCompareExchangePointer(&Ring->PacketQueue, (PVOID)New, (PVOID)Old) != Old); } -static DECLSPEC_NOINLINE BOOLEAN +static DECLSPEC_NOINLINE VOID ReceiverRingPoll( IN PXENVIF_RECEIVER_RING Ring ) { -#define XENVIF_RECEIVER_BATCH(_Ring) (RING_SIZE(&(_Ring)->Front) / 4) - PXENVIF_RECEIVER Receiver; PXENVIF_FRONTEND Frontend; - BOOLEAN Retry; Receiver = Ring->Receiver; Frontend = Receiver->Frontend; - Retry = FALSE; if (!Ring->Enabled) - goto done; + return; for (;;) { BOOLEAN Error; @@ -2016,9 +2012,6 @@ ReceiverRingPoll( TailMdl = NULL; EOP = TRUE; - if (Retry) - break; - KeMemoryBarrier(); rsp_prod = Ring->Shared->rsp_prod; @@ -2036,7 +2029,7 @@ ReceiverRingPoll( break; } - while (rsp_cons != rsp_prod && !Retry) { + while (rsp_cons != rsp_prod) { netif_rx_response_t *rsp; uint16_t id; PXENVIF_RECEIVER_FRAGMENT Fragment; @@ -2193,9 +2186,6 @@ ReceiverRingPoll( __ReceiverRingQueuePacket(Ring, Packet); } - if (rsp_cons - Ring->Front.rsp_cons > XENVIF_RECEIVER_BATCH(Ring)) - Retry = TRUE; - Error = FALSE; Info = 0; MaximumSegmentSize = 0; @@ -2226,11 +2216,6 @@ ReceiverRingPoll( if (Ring->PacketQueue != NULL && KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL)) Ring->QueueDpcs++; - -done: - return Retry; - -#undef XENVIF_RECEIVER_BATCH } static FORCEINLINE VOID @@ -2274,16 +2259,12 @@ ReceiverRingPollDpc( ASSERT(Ring != NULL); for (;;) { - BOOLEAN Retry; - __ReceiverRingAcquireLock(Ring); - Retry = ReceiverRingPoll(Ring); + ReceiverRingPoll(Ring); __ReceiverRingReleaseLock(Ring); - if (!Retry) { - __ReceiverRingUnmask(Ring); - break; - } + __ReceiverRingUnmask(Ring); + break; } } diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index 6895f2c..5e53f9a 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -2614,32 +2614,25 @@ done: Ring->PacketsCompleted++; } -static DECLSPEC_NOINLINE BOOLEAN +static DECLSPEC_NOINLINE VOID TransmitterRingPoll( IN PXENVIF_TRANSMITTER_RING Ring ) { -#define XENVIF_TRANSMITTER_BATCH(_Ring) (RING_SIZE(&(_Ring)->Front) / 4) - PXENVIF_TRANSMITTER Transmitter; PXENVIF_FRONTEND Frontend; - BOOLEAN Retry; Transmitter = Ring->Transmitter; Frontend = Transmitter->Frontend; - Retry = FALSE; if (!Ring->Enabled) - goto done; + return; for (;;) { RING_IDX rsp_prod; RING_IDX rsp_cons; ULONG Extra; - if (Retry) - break; - KeMemoryBarrier(); rsp_prod = Ring->Shared->rsp_prod; @@ -2658,7 +2651,7 @@ TransmitterRingPoll( } Extra = 0; - while (rsp_cons != rsp_prod && !Retry) { + while (rsp_cons != rsp_prod) { netif_tx_response_t *rsp; uint16_t id; PXENVIF_TRANSMITTER_FRAGMENT Fragment; @@ -2785,9 +2778,6 @@ TransmitterRingPoll( Packet->Completion.Status = XENVIF_TRANSMITTER_PACKET_OK; __TransmitterRingCompletePacket(Ring, Packet); - - if (rsp_cons - Ring->Front.rsp_cons > XENVIF_TRANSMITTER_BATCH(Ring)) - Retry = TRUE; } ASSERT3U(Extra, ==, 0); @@ -2795,11 +2785,6 @@ TransmitterRingPoll( Ring->Front.rsp_cons = rsp_cons; } - -done: - return Retry; - -#undef XENVIF_TRANSMITTER_BATCH } static FORCEINLINE VOID @@ -3270,16 +3255,12 @@ TransmitterRingPollDpc( ASSERT(Ring != NULL); for (;;) { - BOOLEAN Retry; - __TransmitterRingAcquireLock(Ring); - Retry = TransmitterRingPoll(Ring); + TransmitterRingPoll(Ring); __TransmitterRingReleaseLock(Ring); - if (!Retry) { - __TransmitterRingUnmask(Ring); - break; - } + __TransmitterRingUnmask(Ring); + 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 |