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

Function apply_profile

dpdk/examples/service_cores/main.c:112–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110#define NUM_PROFILES RTE_DIM(profiles)
111
112static void
113apply_profile(int profile_id)
114{
115 uint32_t i;
116 uint32_t s;
117 int ret;
118 struct profile *p = &profiles[profile_id];
119 const uint8_t core_off = 1;
120
121 if (p->num_cores > rte_lcore_count() - 1) {
122 printf("insufficent cores to run (%s)",
123 p->name);
124 return;
125 }
126
127 for (i = 0; i < p->num_cores; i++) {
128 uint32_t core = i + core_off;
129 ret = rte_service_lcore_add(core);
130 if (ret && ret != -EALREADY)
131 printf("core %d added ret %d\n", core, ret);
132
133 ret = rte_service_lcore_start(core);
134 if (ret && ret != -EALREADY)
135 printf("core %d start ret %d\n", core, ret);
136
137 for (s = 0; s < NUM_SERVICES; s++) {
138 if (rte_service_map_lcore_set(s, core,
139 p->cores[i].mapped_services[s]))
140 printf("failed to map lcore %d\n", core);
141 }
142 }
143
144 for ( ; i < PROFILE_CORES_MAX; i++) {
145 uint32_t core = i + core_off;
146 for (s = 0; s < NUM_SERVICES; s++) {
147 ret = rte_service_map_lcore_set(s, core, 0);
148 if (ret && ret != -EINVAL) {
149 printf("%s %d: map lcore set = %d\n", __func__,
150 __LINE__, ret);
151 }
152 }
153 ret = rte_service_lcore_stop(core);
154 if (ret && ret != -EALREADY) {
155 printf("%s %d: lcore stop = %d\n", __func__,
156 __LINE__, ret);
157 }
158 ret = rte_service_lcore_del(core);
159 if (ret && ret != -EINVAL) {
160 printf("%s %d: lcore del = %d\n", __func__,
161 __LINE__, ret);
162 }
163 }
164}
165
166int
167main(int argc, char **argv)

Callers 1

mainFunction · 0.85

Calls 7

rte_lcore_countFunction · 0.85
rte_service_lcore_addFunction · 0.85
rte_service_lcore_startFunction · 0.85
rte_service_lcore_stopFunction · 0.85
rte_service_lcore_delFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected