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

Function thread_init

dpdk/examples/pipeline/thread.c:63–104  ·  view source on GitHub ↗

* Control plane (CP) thread. */

Source from the content-addressed store, hash-verified

61 * Control plane (CP) thread.
62 */
63int
64thread_init(void)
65{
66 uint32_t thread_id;
67 int status = 0;
68
69 RTE_LCORE_FOREACH_WORKER(thread_id) {
70 struct thread *t = &threads[thread_id];
71 uint32_t i;
72
73 t->enabled = 1;
74
75 for (i = 0; i < THREAD_BLOCKS_MAX; i++) {
76 struct block *b;
77
78 b = calloc(1, sizeof(struct block));
79 if (!b) {
80 status = -ENOMEM;
81 goto error;
82 }
83
84 t->blocks[i] = b;
85 }
86 }
87
88 return 0;
89
90error:
91 RTE_LCORE_FOREACH_WORKER(thread_id) {
92 struct thread *t = &threads[thread_id];
93 uint32_t i;
94
95 t->enabled = 0;
96
97 for (i = 0; i < THREAD_BLOCKS_MAX; i++) {
98 free(t->blocks[i]);
99 t->blocks[i] = NULL;
100 }
101 }
102
103 return status;
104}
105
106static uint32_t
107pipeline_find(struct rte_swx_pipeline *p)

Callers 1

mainFunction · 0.70

Calls 2

callocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected