]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Make sure event counter is updated before finish receiver ring poll
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 18 Sep 2018 13:24:15 +0000 (14:24 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 18 Sep 2018 13:53:09 +0000 (14:53 +0100)
There was a flaw in commit 5932938b "Don't bump the receiver event counter
if the poller is going to retry" in that it is possible to drop out of
poll without ever updating the event counter (if one attempt requests a
retry and the next attempt finds nothing to do). This patch fixes the
issue by using the RING_FINAL_CHECK_FOR_RESPONSES macro to update the
event counter, which checks for a race with new responses.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenvif/receiver.c

index 1f64fabbe3d02d3a90444c1393c827ff26468141..3ee5a06a8edd1d77bbc96fb77fb0fe2fbb13906d 100644 (file)
@@ -1969,8 +1969,13 @@ ReceiverRingPoll(
 
         KeMemoryBarrier();
 
-        if (rsp_cons == rsp_prod)
-            break;
+        if (rsp_cons == rsp_prod) {
+            RING_IDX WorkToDo;
+
+            RING_FINAL_CHECK_FOR_RESPONSES(&Ring->Front, WorkToDo);
+            if (!WorkToDo)
+                break;
+        }
 
         while (rsp_cons != rsp_prod && !Retry) {
             netif_rx_response_t         *rsp;
@@ -2156,9 +2161,6 @@ ReceiverRingPoll(
         KeMemoryBarrier();
 
         Ring->Front.rsp_cons = rsp_cons;
-        if (!Retry)
-            Ring->Shared->rsp_event = rsp_cons + 1;
-
     }
 
     if (!__ReceiverRingIsStopped(Ring))