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

Function thread_pipeline_enable

dpdk/examples/ip_pipeline/thread.c:254–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254int
255thread_pipeline_enable(uint32_t thread_id,
256 const char *pipeline_name)
257{
258 struct pipeline *p = pipeline_find(pipeline_name);
259 struct thread *t;
260 struct thread_msg_req *req;
261 struct thread_msg_rsp *rsp;
262 uint32_t i;
263 int status;
264
265 /* Check input params */
266 if ((thread_id >= RTE_MAX_LCORE) ||
267 (p == NULL) ||
268 (p->n_ports_in == 0) ||
269 (p->n_ports_out == 0) ||
270 (p->n_tables == 0))
271 return -1;
272
273 t = &thread[thread_id];
274 if ((t->enabled == 0) ||
275 p->enabled)
276 return -1;
277
278 if (!thread_is_running(thread_id)) {
279 struct thread_data *td = &thread_data[thread_id];
280 struct pipeline_data *tdp = &td->pipeline_data[td->n_pipelines];
281
282 if (td->n_pipelines >= THREAD_PIPELINES_MAX)
283 return -1;
284
285 /* Data plane thread */
286 td->p[td->n_pipelines] = p->p;
287
288 tdp->p = p->p;
289 for (i = 0; i < p->n_tables; i++)
290 tdp->table_data[i].a = p->table[i].a;
291
292 tdp->n_tables = p->n_tables;
293
294 tdp->msgq_req = p->msgq_req;
295 tdp->msgq_rsp = p->msgq_rsp;
296 tdp->timer_period = (rte_get_tsc_hz() * p->timer_period_ms) / 1000;
297 tdp->time_next = rte_get_tsc_cycles() + tdp->timer_period;
298
299 td->n_pipelines++;
300
301 /* Pipeline */
302 p->thread_id = thread_id;
303 p->enabled = 1;
304
305 return 0;
306 }
307
308 /* Allocate request */
309 req = thread_msg_alloc();
310 if (req == NULL)
311 return -1;

Callers 1

Calls 7

rte_get_tsc_hzFunction · 0.85
pipeline_findFunction · 0.70
thread_is_runningFunction · 0.70
thread_msg_allocFunction · 0.70
thread_msg_send_recvFunction · 0.70
thread_msg_freeFunction · 0.70
rte_get_tsc_cyclesFunction · 0.50

Tested by

no test coverage detected