ipsec: IPSec protection for multi-point tunnel interfaces
[vpp.git] / src / svm / message_queue.c
index 10266a8..b381173 100644 (file)
@@ -170,6 +170,7 @@ void
 svm_msg_q_free_msg (svm_msg_q_t * mq, svm_msg_q_msg_t * msg)
 {
   svm_msg_q_ring_t *ring;
+  int need_signal;
 
   ASSERT (vec_len (mq->rings) > msg->ring_index);
   ring = &mq->rings[msg->ring_index];
@@ -183,7 +184,12 @@ svm_msg_q_free_msg (svm_msg_q_t * mq, svm_msg_q_msg_t * msg)
       /* for now, expect messages to be processed in order */
       ASSERT (0);
     }
+
+  need_signal = ring->cursize == ring->nitems;
   clib_atomic_fetch_sub (&ring->cursize, 1);
+
+  if (PREDICT_FALSE (need_signal))
+    svm_queue_send_signal (mq->q, 0);
 }
 
 static int