vcl: allow more rx events on peek 68/40868/2
authorFlorin Coras <[email protected]>
Fri, 3 May 2024 20:23:00 +0000 (13:23 -0700)
committerFlorin Coras <[email protected]>
Fri, 3 May 2024 20:05:33 +0000 (20:05 +0000)
If peek touches all data in the fifo, unset fifo event to request new
events when more data is enqueued.

Type: improvement

Signed-off-by: Florin Coras <[email protected]>
Change-Id: I878fa017f18ada5cef557600673bba920f230542

src/vcl/vppcom.c

index 58f6ac0..a557093 100644 (file)
@@ -2087,7 +2087,16 @@ read_again:
   ASSERT (rv >= 0);
 
   if (peek)
-    return rv;
+    {
+      /* Request new notifications if more data enqueued */
+      if (rv < n || rv == svm_fifo_max_dequeue_cons (rx_fifo))
+       {
+         if (is_ct)
+           svm_fifo_unset_event (s->rx_fifo);
+         svm_fifo_unset_event (rx_fifo);
+       }
+      return rv;
+    }
 
   n_read += rv;