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

Function rte_service_init

dpdk/lib/eal/common/rte_service.c:81–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79static uint32_t rte_service_library_initialized;
80
81int32_t
82rte_service_init(void)
83{
84 /* Hard limit due to the use of an uint64_t-based bitmask (and the
85 * clzl intrinsic).
86 */
87 RTE_BUILD_BUG_ON(RTE_SERVICE_NUM_MAX > 64);
88
89 if (rte_service_library_initialized) {
90 RTE_LOG(NOTICE, EAL,
91 "service library init() called, init flag %d\n",
92 rte_service_library_initialized);
93 return -EALREADY;
94 }
95
96 rte_services = rte_calloc("rte_services", RTE_SERVICE_NUM_MAX,
97 sizeof(struct rte_service_spec_impl),
98 RTE_CACHE_LINE_SIZE);
99 if (!rte_services) {
100 RTE_LOG(ERR, EAL, "error allocating rte services array\n");
101 goto fail_mem;
102 }
103
104 lcore_states = rte_calloc("rte_service_core_states", RTE_MAX_LCORE,
105 sizeof(struct core_state), RTE_CACHE_LINE_SIZE);
106 if (!lcore_states) {
107 RTE_LOG(ERR, EAL, "error allocating core states array\n");
108 goto fail_mem;
109 }
110
111 int i;
112 struct rte_config *cfg = rte_eal_get_configuration();
113 for (i = 0; i < RTE_MAX_LCORE; i++) {
114 if (lcore_config[i].core_role == ROLE_SERVICE) {
115 if ((unsigned int)i == cfg->main_lcore)
116 continue;
117 rte_service_lcore_add(i);
118 }
119 }
120
121 rte_service_library_initialized = 1;
122 return 0;
123fail_mem:
124 rte_free(rte_services);
125 rte_free(lcore_states);
126 return -ENOMEM;
127}
128
129void
130rte_service_finalize(void)

Callers 3

rte_eal_initFunction · 0.85
rte_eal_initFunction · 0.85
rte_eal_initFunction · 0.85

Calls 4

rte_callocFunction · 0.85
rte_service_lcore_addFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected