Introduce first version of TCP code.
[tldk.git] / lib / libtle_l4p / tle_event.h
similarity index 93%
rename from lib/libtle_udp/tle_event.h
rename to lib/libtle_l4p/tle_event.h
index 9357def..b19954a 100644 (file)
@@ -17,6 +17,7 @@
 #define _SEV_IMPL_H_
 
 #include <rte_common.h>
+#include <rte_memory.h>
 #include <rte_spinlock.h>
 #include <rte_atomic.h>
 #include <sys/queue.h>
@@ -210,6 +211,26 @@ tle_event_idle(struct tle_event *ev)
        rte_spinlock_unlock(&q->lock);
 }
 
+static inline void
+tle_evq_idle(struct tle_evq *evq, struct tle_event *ev[], uint32_t num)
+{
+       uint32_t i, n;
+
+       rte_spinlock_lock(&evq->lock);
+
+       n = 0;
+       for (i = 0; i != num; i++) {
+               if (ev[i]->state == TLE_SEV_UP) {
+                       TAILQ_REMOVE(&evq->armed, ev[i], ql);
+                       n++;
+               }
+               ev[i]->state = TLE_SEV_IDLE;
+       }
+
+       evq->nb_armed -= n;
+       rte_spinlock_unlock(&evq->lock);
+}
+
 
 /*
  * return up to *num* user data pointers associated with