examples/ipsec-secgw: use HW parsed packet type in poll mode
[dpdk.git] / examples / pipeline / thread.c
index 7ff22e9..5fe7eae 100644 (file)
 #define THREAD_TIMER_PERIOD_MS                             100
 #endif
 
+/* Pipeline instruction quanta: Needs to be big enough to do some meaningful
+ * work, but not too big to avoid starving any other pipelines mapped to the
+ * same thread. For a pipeline that executes 10 instructions per packet, a
+ * quanta of 1000 instructions equates to processing 100 packets.
+ */
+#ifndef PIPELINE_INSTR_QUANTA
+#define PIPELINE_INSTR_QUANTA                              1000
+#endif
+
 /**
  * Control thread: data plane thread context
  */
@@ -80,11 +89,9 @@ thread_free(void)
                        continue;
 
                /* MSGQs */
-               if (t->msgq_req)
-                       rte_ring_free(t->msgq_req);
+               rte_ring_free(t->msgq_req);
 
-               if (t->msgq_rsp)
-                       rte_ring_free(t->msgq_rsp);
+               rte_ring_free(t->msgq_rsp);
        }
 }
 
@@ -93,7 +100,7 @@ thread_init(void)
 {
        uint32_t i;
 
-       RTE_LCORE_FOREACH_SLAVE(i) {
+       RTE_LCORE_FOREACH_WORKER(i) {
                char name[NAME_MAX];
                struct rte_ring *msgq_req, *msgq_rsp;
                struct thread *t = &thread[i];
@@ -517,7 +524,7 @@ thread_main(void *arg __rte_unused)
 
                /* Data Plane */
                for (j = 0; j < t->n_pipelines; j++)
-                       rte_swx_pipeline_run(t->p[j], 1000000);
+                       rte_swx_pipeline_run(t->p[j], PIPELINE_INSTR_QUANTA);
 
                /* Control Plane */
                if ((i & 0xF) == 0) {