MCPcopy Create free account
hub / github.com/F-Stack/f-stack / thread_main

Function thread_main

dpdk/examples/ip_pipeline/thread.c:3081–3142  ·  view source on GitHub ↗

* Data plane threads: main */

Source from the content-addressed store, hash-verified

3079 * Data plane threads: main
3080 */
3081int
3082thread_main(void *arg __rte_unused)
3083{
3084 struct thread_data *t;
3085 uint32_t thread_id, i;
3086
3087 thread_id = rte_lcore_id();
3088 t = &thread_data[thread_id];
3089
3090 /* Dispatch loop */
3091 for (i = 0; ; i++) {
3092 uint32_t j;
3093
3094 /* Data Plane */
3095 for (j = 0; j < t->n_pipelines; j++)
3096 rte_pipeline_run(t->p[j]);
3097
3098 /* Control Plane */
3099 if ((i & 0xF) == 0) {
3100 uint64_t time = rte_get_tsc_cycles();
3101 uint64_t time_next_min = UINT64_MAX;
3102
3103 if (time < t->time_next_min)
3104 continue;
3105
3106 /* Pipeline message queues */
3107 for (j = 0; j < t->n_pipelines; j++) {
3108 struct pipeline_data *p =
3109 &t->pipeline_data[j];
3110 uint64_t time_next = p->time_next;
3111
3112 if (time_next <= time) {
3113 pipeline_msg_handle(p);
3114 rte_pipeline_flush(p->p);
3115 time_next = time + p->timer_period;
3116 p->time_next = time_next;
3117 }
3118
3119 if (time_next < time_next_min)
3120 time_next_min = time_next;
3121 }
3122
3123 /* Thread message queues */
3124 {
3125 uint64_t time_next = t->time_next;
3126
3127 if (time_next <= time) {
3128 thread_msg_handle(t);
3129 time_next = time + t->timer_period;
3130 t->time_next = time_next;
3131 }
3132
3133 if (time_next < time_next_min)
3134 time_next_min = time_next;
3135 }
3136
3137 t->time_next_min = time_next_min;
3138 }

Callers

nothing calls this directly

Calls 6

rte_lcore_idFunction · 0.85
rte_pipeline_runFunction · 0.85
pipeline_msg_handleFunction · 0.85
rte_pipeline_flushFunction · 0.85
thread_msg_handleFunction · 0.70
rte_get_tsc_cyclesFunction · 0.50

Tested by

no test coverage detected