lib: use SPDX tag for Intel copyright files
[dpdk.git] / lib / librte_eal / common / rte_service.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4
5 #include <stdio.h>
6 #include <unistd.h>
7 #include <inttypes.h>
8 #include <limits.h>
9 #include <string.h>
10 #include <dirent.h>
11
12 #include <rte_service.h>
13 #include "include/rte_service_component.h"
14
15 #include <rte_eal.h>
16 #include <rte_lcore.h>
17 #include <rte_common.h>
18 #include <rte_debug.h>
19 #include <rte_cycles.h>
20 #include <rte_atomic.h>
21 #include <rte_memory.h>
22 #include <rte_malloc.h>
23
24 #define RTE_SERVICE_NUM_MAX 64
25
26 #define SERVICE_F_REGISTERED    (1 << 0)
27 #define SERVICE_F_STATS_ENABLED (1 << 1)
28 #define SERVICE_F_START_CHECK   (1 << 2)
29
30 /* runstates for services and lcores, denoting if they are active or not */
31 #define RUNSTATE_STOPPED 0
32 #define RUNSTATE_RUNNING 1
33
34 /* internal representation of a service */
35 struct rte_service_spec_impl {
36         /* public part of the struct */
37         struct rte_service_spec spec;
38
39         /* atomic lock that when set indicates a service core is currently
40          * running this service callback. When not set, a core may take the
41          * lock and then run the service callback.
42          */
43         rte_atomic32_t execute_lock;
44
45         /* API set/get-able variables */
46         int8_t app_runstate;
47         int8_t comp_runstate;
48         uint8_t internal_flags;
49
50         /* per service statistics */
51         rte_atomic32_t num_mapped_cores;
52         uint64_t calls;
53         uint64_t cycles_spent;
54 } __rte_cache_aligned;
55
56 /* the internal values of a service core */
57 struct core_state {
58         /* map of services IDs are run on this core */
59         uint64_t service_mask;
60         uint8_t runstate; /* running or stopped */
61         uint8_t is_service_core; /* set if core is currently a service core */
62
63         /* extreme statistics */
64         uint64_t calls_per_service[RTE_SERVICE_NUM_MAX];
65 } __rte_cache_aligned;
66
67 static uint32_t rte_service_count;
68 static struct rte_service_spec_impl *rte_services;
69 static struct core_state *lcore_states;
70 static uint32_t rte_service_library_initialized;
71
72 int32_t rte_service_init(void)
73 {
74         if (rte_service_library_initialized) {
75                 printf("service library init() called, init flag %d\n",
76                         rte_service_library_initialized);
77                 return -EALREADY;
78         }
79
80         rte_services = rte_calloc("rte_services", RTE_SERVICE_NUM_MAX,
81                         sizeof(struct rte_service_spec_impl),
82                         RTE_CACHE_LINE_SIZE);
83         if (!rte_services) {
84                 printf("error allocating rte services array\n");
85                 return -ENOMEM;
86         }
87
88         lcore_states = rte_calloc("rte_service_core_states", RTE_MAX_LCORE,
89                         sizeof(struct core_state), RTE_CACHE_LINE_SIZE);
90         if (!lcore_states) {
91                 printf("error allocating core states array\n");
92                 return -ENOMEM;
93         }
94
95         int i;
96         int count = 0;
97         struct rte_config *cfg = rte_eal_get_configuration();
98         for (i = 0; i < RTE_MAX_LCORE; i++) {
99                 if (lcore_config[i].core_role == ROLE_SERVICE) {
100                         if ((unsigned int)i == cfg->master_lcore)
101                                 continue;
102                         rte_service_lcore_add(i);
103                         count++;
104                 }
105         }
106
107         rte_service_library_initialized = 1;
108         return 0;
109 }
110
111 /* returns 1 if service is registered and has not been unregistered
112  * Returns 0 if service never registered, or has been unregistered
113  */
114 static inline int
115 service_valid(uint32_t id)
116 {
117         return !!(rte_services[id].internal_flags & SERVICE_F_REGISTERED);
118 }
119
120 /* validate ID and retrieve service pointer, or return error value */
121 #define SERVICE_VALID_GET_OR_ERR_RET(id, service, retval) do {          \
122         if (id >= RTE_SERVICE_NUM_MAX || !service_valid(id))            \
123                 return retval;                                          \
124         service = &rte_services[id];                                    \
125 } while (0)
126
127 /* returns 1 if statistics should be collected for service
128  * Returns 0 if statistics should not be collected for service
129  */
130 static inline int
131 service_stats_enabled(struct rte_service_spec_impl *impl)
132 {
133         return !!(impl->internal_flags & SERVICE_F_STATS_ENABLED);
134 }
135
136 static inline int
137 service_mt_safe(struct rte_service_spec_impl *s)
138 {
139         return !!(s->spec.capabilities & RTE_SERVICE_CAP_MT_SAFE);
140 }
141
142 int32_t rte_service_set_stats_enable(uint32_t id, int32_t enabled)
143 {
144         struct rte_service_spec_impl *s;
145         SERVICE_VALID_GET_OR_ERR_RET(id, s, 0);
146
147         if (enabled)
148                 s->internal_flags |= SERVICE_F_STATS_ENABLED;
149         else
150                 s->internal_flags &= ~(SERVICE_F_STATS_ENABLED);
151
152         return 0;
153 }
154
155 int32_t rte_service_set_runstate_mapped_check(uint32_t id, int32_t enabled)
156 {
157         struct rte_service_spec_impl *s;
158         SERVICE_VALID_GET_OR_ERR_RET(id, s, 0);
159
160         if (enabled)
161                 s->internal_flags |= SERVICE_F_START_CHECK;
162         else
163                 s->internal_flags &= ~(SERVICE_F_START_CHECK);
164
165         return 0;
166 }
167
168 uint32_t
169 rte_service_get_count(void)
170 {
171         return rte_service_count;
172 }
173
174 int32_t rte_service_get_by_name(const char *name, uint32_t *service_id)
175 {
176         if (!service_id)
177                 return -EINVAL;
178
179         int i;
180         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
181                 if (service_valid(i) &&
182                                 strcmp(name, rte_services[i].spec.name) == 0) {
183                         *service_id = i;
184                         return 0;
185                 }
186         }
187
188         return -ENODEV;
189 }
190
191 const char *
192 rte_service_get_name(uint32_t id)
193 {
194         struct rte_service_spec_impl *s;
195         SERVICE_VALID_GET_OR_ERR_RET(id, s, 0);
196         return s->spec.name;
197 }
198
199 int32_t
200 rte_service_probe_capability(uint32_t id, uint32_t capability)
201 {
202         struct rte_service_spec_impl *s;
203         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
204         return !!(s->spec.capabilities & capability);
205 }
206
207 int32_t
208 rte_service_component_register(const struct rte_service_spec *spec,
209                                uint32_t *id_ptr)
210 {
211         uint32_t i;
212         int32_t free_slot = -1;
213
214         if (spec->callback == NULL || strlen(spec->name) == 0)
215                 return -EINVAL;
216
217         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
218                 if (!service_valid(i)) {
219                         free_slot = i;
220                         break;
221                 }
222         }
223
224         if ((free_slot < 0) || (i == RTE_SERVICE_NUM_MAX))
225                 return -ENOSPC;
226
227         struct rte_service_spec_impl *s = &rte_services[free_slot];
228         s->spec = *spec;
229         s->internal_flags |= SERVICE_F_REGISTERED | SERVICE_F_START_CHECK;
230
231         rte_smp_wmb();
232         rte_service_count++;
233
234         if (id_ptr)
235                 *id_ptr = free_slot;
236
237         return 0;
238 }
239
240 int32_t
241 rte_service_component_unregister(uint32_t id)
242 {
243         uint32_t i;
244         struct rte_service_spec_impl *s;
245         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
246
247         rte_service_count--;
248         rte_smp_wmb();
249
250         s->internal_flags &= ~(SERVICE_F_REGISTERED);
251
252         /* clear the run-bit in all cores */
253         for (i = 0; i < RTE_MAX_LCORE; i++)
254                 lcore_states[i].service_mask &= ~(UINT64_C(1) << id);
255
256         memset(&rte_services[id], 0, sizeof(struct rte_service_spec_impl));
257
258         return 0;
259 }
260
261 int32_t
262 rte_service_component_runstate_set(uint32_t id, uint32_t runstate)
263 {
264         struct rte_service_spec_impl *s;
265         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
266
267         if (runstate)
268                 s->comp_runstate = RUNSTATE_RUNNING;
269         else
270                 s->comp_runstate = RUNSTATE_STOPPED;
271
272         rte_smp_wmb();
273         return 0;
274 }
275
276 int32_t
277 rte_service_runstate_set(uint32_t id, uint32_t runstate)
278 {
279         struct rte_service_spec_impl *s;
280         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
281
282         if (runstate)
283                 s->app_runstate = RUNSTATE_RUNNING;
284         else
285                 s->app_runstate = RUNSTATE_STOPPED;
286
287         rte_smp_wmb();
288         return 0;
289 }
290
291 int32_t
292 rte_service_runstate_get(uint32_t id)
293 {
294         struct rte_service_spec_impl *s;
295         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
296         rte_smp_rmb();
297
298         int check_disabled = !(s->internal_flags & SERVICE_F_START_CHECK);
299         int lcore_mapped = (rte_atomic32_read(&s->num_mapped_cores) > 0);
300
301         return (s->app_runstate == RUNSTATE_RUNNING) &&
302                 (s->comp_runstate == RUNSTATE_RUNNING) &&
303                 (check_disabled | lcore_mapped);
304 }
305
306 static inline void
307 rte_service_runner_do_callback(struct rte_service_spec_impl *s,
308                                struct core_state *cs, uint32_t service_idx)
309 {
310         void *userdata = s->spec.callback_userdata;
311
312         if (service_stats_enabled(s)) {
313                 uint64_t start = rte_rdtsc();
314                 s->spec.callback(userdata);
315                 uint64_t end = rte_rdtsc();
316                 s->cycles_spent += end - start;
317                 cs->calls_per_service[service_idx]++;
318                 s->calls++;
319         } else
320                 s->spec.callback(userdata);
321 }
322
323
324 static inline int32_t
325 service_run(uint32_t i, struct core_state *cs, uint64_t service_mask)
326 {
327         if (!service_valid(i))
328                 return -EINVAL;
329         struct rte_service_spec_impl *s = &rte_services[i];
330         if (s->comp_runstate != RUNSTATE_RUNNING ||
331                         s->app_runstate != RUNSTATE_RUNNING ||
332                         !(service_mask & (UINT64_C(1) << i)))
333                 return -ENOEXEC;
334
335         /* check do we need cmpset, if MT safe or <= 1 core
336          * mapped, atomic ops are not required.
337          */
338         const int use_atomics = (service_mt_safe(s) == 0) &&
339                                 (rte_atomic32_read(&s->num_mapped_cores) > 1);
340         if (use_atomics) {
341                 if (!rte_atomic32_cmpset((uint32_t *)&s->execute_lock, 0, 1))
342                         return -EBUSY;
343
344                 rte_service_runner_do_callback(s, cs, i);
345                 rte_atomic32_clear(&s->execute_lock);
346         } else
347                 rte_service_runner_do_callback(s, cs, i);
348
349         return 0;
350 }
351
352 int32_t rte_service_run_iter_on_app_lcore(uint32_t id,
353                 uint32_t serialize_mt_unsafe)
354 {
355         /* run service on calling core, using all-ones as the service mask */
356         if (!service_valid(id))
357                 return -EINVAL;
358
359         struct core_state *cs = &lcore_states[rte_lcore_id()];
360         struct rte_service_spec_impl *s = &rte_services[id];
361
362         /* Atomically add this core to the mapped cores first, then examine if
363          * we can run the service. This avoids a race condition between
364          * checking the value, and atomically adding to the mapped count.
365          */
366         if (serialize_mt_unsafe)
367                 rte_atomic32_inc(&s->num_mapped_cores);
368
369         if (service_mt_safe(s) == 0 &&
370                         rte_atomic32_read(&s->num_mapped_cores) > 1) {
371                 if (serialize_mt_unsafe)
372                         rte_atomic32_dec(&s->num_mapped_cores);
373                 return -EBUSY;
374         }
375
376         int ret = service_run(id, cs, UINT64_MAX);
377
378         if (serialize_mt_unsafe)
379                 rte_atomic32_dec(&s->num_mapped_cores);
380
381         return ret;
382 }
383
384 static int32_t
385 rte_service_runner_func(void *arg)
386 {
387         RTE_SET_USED(arg);
388         uint32_t i;
389         const int lcore = rte_lcore_id();
390         struct core_state *cs = &lcore_states[lcore];
391
392         while (lcore_states[lcore].runstate == RUNSTATE_RUNNING) {
393                 const uint64_t service_mask = cs->service_mask;
394
395                 for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
396                         /* return value ignored as no change to code flow */
397                         service_run(i, cs, service_mask);
398                 }
399
400                 rte_smp_rmb();
401         }
402
403         lcore_config[lcore].state = WAIT;
404
405         return 0;
406 }
407
408 int32_t
409 rte_service_lcore_count(void)
410 {
411         int32_t count = 0;
412         uint32_t i;
413         for (i = 0; i < RTE_MAX_LCORE; i++)
414                 count += lcore_states[i].is_service_core;
415         return count;
416 }
417
418 int32_t
419 rte_service_lcore_list(uint32_t array[], uint32_t n)
420 {
421         uint32_t count = rte_service_lcore_count();
422         if (count > n)
423                 return -ENOMEM;
424
425         if (!array)
426                 return -EINVAL;
427
428         uint32_t i;
429         uint32_t idx = 0;
430         for (i = 0; i < RTE_MAX_LCORE; i++) {
431                 struct core_state *cs = &lcore_states[i];
432                 if (cs->is_service_core) {
433                         array[idx] = i;
434                         idx++;
435                 }
436         }
437
438         return count;
439 }
440
441 int32_t
442 rte_service_lcore_count_services(uint32_t lcore)
443 {
444         if (lcore >= RTE_MAX_LCORE)
445                 return -EINVAL;
446
447         struct core_state *cs = &lcore_states[lcore];
448         if (!cs->is_service_core)
449                 return -ENOTSUP;
450
451         return __builtin_popcountll(cs->service_mask);
452 }
453
454 int32_t
455 rte_service_start_with_defaults(void)
456 {
457         /* create a default mapping from cores to services, then start the
458          * services to make them transparent to unaware applications.
459          */
460         uint32_t i;
461         int ret;
462         uint32_t count = rte_service_get_count();
463
464         int32_t lcore_iter = 0;
465         uint32_t ids[RTE_MAX_LCORE] = {0};
466         int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE);
467
468         if (lcore_count == 0)
469                 return -ENOTSUP;
470
471         for (i = 0; (int)i < lcore_count; i++)
472                 rte_service_lcore_start(ids[i]);
473
474         for (i = 0; i < count; i++) {
475                 /* do 1:1 core mapping here, with each service getting
476                  * assigned a single core by default. Adding multiple services
477                  * should multiplex to a single core, or 1:1 if there are the
478                  * same amount of services as service-cores
479                  */
480                 ret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);
481                 if (ret)
482                         return -ENODEV;
483
484                 lcore_iter++;
485                 if (lcore_iter >= lcore_count)
486                         lcore_iter = 0;
487
488                 ret = rte_service_runstate_set(i, 1);
489                 if (ret)
490                         return -ENOEXEC;
491         }
492
493         return 0;
494 }
495
496 static int32_t
497 service_update(struct rte_service_spec *service, uint32_t lcore,
498                 uint32_t *set, uint32_t *enabled)
499 {
500         uint32_t i;
501         int32_t sid = -1;
502
503         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
504                 if ((struct rte_service_spec *)&rte_services[i] == service &&
505                                 service_valid(i)) {
506                         sid = i;
507                         break;
508                 }
509         }
510
511         if (sid == -1 || lcore >= RTE_MAX_LCORE)
512                 return -EINVAL;
513
514         if (!lcore_states[lcore].is_service_core)
515                 return -EINVAL;
516
517         uint64_t sid_mask = UINT64_C(1) << sid;
518         if (set) {
519                 if (*set) {
520                         lcore_states[lcore].service_mask |= sid_mask;
521                         rte_atomic32_inc(&rte_services[sid].num_mapped_cores);
522                 } else {
523                         lcore_states[lcore].service_mask &= ~(sid_mask);
524                         rte_atomic32_dec(&rte_services[sid].num_mapped_cores);
525                 }
526         }
527
528         if (enabled)
529                 *enabled = !!(lcore_states[lcore].service_mask & (sid_mask));
530
531         rte_smp_wmb();
532
533         return 0;
534 }
535
536 int32_t
537 rte_service_map_lcore_set(uint32_t id, uint32_t lcore, uint32_t enabled)
538 {
539         struct rte_service_spec_impl *s;
540         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
541         uint32_t on = enabled > 0;
542         return service_update(&s->spec, lcore, &on, 0);
543 }
544
545 int32_t
546 rte_service_map_lcore_get(uint32_t id, uint32_t lcore)
547 {
548         struct rte_service_spec_impl *s;
549         SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
550         uint32_t enabled;
551         int ret = service_update(&s->spec, lcore, 0, &enabled);
552         if (ret == 0)
553                 return enabled;
554         return ret;
555 }
556
557 int32_t rte_service_lcore_reset_all(void)
558 {
559         /* loop over cores, reset all to mask 0 */
560         uint32_t i;
561         for (i = 0; i < RTE_MAX_LCORE; i++) {
562                 lcore_states[i].service_mask = 0;
563                 lcore_states[i].is_service_core = 0;
564                 lcore_states[i].runstate = RUNSTATE_STOPPED;
565         }
566         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++)
567                 rte_atomic32_set(&rte_services[i].num_mapped_cores, 0);
568
569         rte_smp_wmb();
570
571         return 0;
572 }
573
574 static void
575 set_lcore_state(uint32_t lcore, int32_t state)
576 {
577         /* mark core state in hugepage backed config */
578         struct rte_config *cfg = rte_eal_get_configuration();
579         cfg->lcore_role[lcore] = state;
580
581         /* mark state in process local lcore_config */
582         lcore_config[lcore].core_role = state;
583
584         /* update per-lcore optimized state tracking */
585         lcore_states[lcore].is_service_core = (state == ROLE_SERVICE);
586 }
587
588 int32_t
589 rte_service_lcore_add(uint32_t lcore)
590 {
591         if (lcore >= RTE_MAX_LCORE)
592                 return -EINVAL;
593         if (lcore_states[lcore].is_service_core)
594                 return -EALREADY;
595
596         set_lcore_state(lcore, ROLE_SERVICE);
597
598         /* ensure that after adding a core the mask and state are defaults */
599         lcore_states[lcore].service_mask = 0;
600         lcore_states[lcore].runstate = RUNSTATE_STOPPED;
601
602         rte_smp_wmb();
603
604         return rte_eal_wait_lcore(lcore);
605 }
606
607 int32_t
608 rte_service_lcore_del(uint32_t lcore)
609 {
610         if (lcore >= RTE_MAX_LCORE)
611                 return -EINVAL;
612
613         struct core_state *cs = &lcore_states[lcore];
614         if (!cs->is_service_core)
615                 return -EINVAL;
616
617         if (cs->runstate != RUNSTATE_STOPPED)
618                 return -EBUSY;
619
620         set_lcore_state(lcore, ROLE_RTE);
621
622         rte_smp_wmb();
623         return 0;
624 }
625
626 int32_t
627 rte_service_lcore_start(uint32_t lcore)
628 {
629         if (lcore >= RTE_MAX_LCORE)
630                 return -EINVAL;
631
632         struct core_state *cs = &lcore_states[lcore];
633         if (!cs->is_service_core)
634                 return -EINVAL;
635
636         if (cs->runstate == RUNSTATE_RUNNING)
637                 return -EALREADY;
638
639         /* set core to run state first, and then launch otherwise it will
640          * return immediately as runstate keeps it in the service poll loop
641          */
642         lcore_states[lcore].runstate = RUNSTATE_RUNNING;
643
644         int ret = rte_eal_remote_launch(rte_service_runner_func, 0, lcore);
645         /* returns -EBUSY if the core is already launched, 0 on success */
646         return ret;
647 }
648
649 int32_t
650 rte_service_lcore_stop(uint32_t lcore)
651 {
652         if (lcore >= RTE_MAX_LCORE)
653                 return -EINVAL;
654
655         if (lcore_states[lcore].runstate == RUNSTATE_STOPPED)
656                 return -EALREADY;
657
658         uint32_t i;
659         uint64_t service_mask = lcore_states[lcore].service_mask;
660         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
661                 int32_t enabled = service_mask & (UINT64_C(1) << i);
662                 int32_t service_running = rte_service_runstate_get(i);
663                 int32_t only_core = (1 ==
664                         rte_atomic32_read(&rte_services[i].num_mapped_cores));
665
666                 /* if the core is mapped, and the service is running, and this
667                  * is the only core that is mapped, the service would cease to
668                  * run if this core stopped, so fail instead.
669                  */
670                 if (enabled && service_running && only_core)
671                         return -EBUSY;
672         }
673
674         lcore_states[lcore].runstate = RUNSTATE_STOPPED;
675
676         return 0;
677 }
678
679 static void
680 rte_service_dump_one(FILE *f, struct rte_service_spec_impl *s,
681                      uint64_t all_cycles, uint32_t reset)
682 {
683         /* avoid divide by zero */
684         if (all_cycles == 0)
685                 all_cycles = 1;
686
687         int calls = 1;
688         if (s->calls != 0)
689                 calls = s->calls;
690
691         fprintf(f, "  %s: stats %d\tcalls %"PRIu64"\tcycles %"
692                         PRIu64"\tavg: %"PRIu64"\n",
693                         s->spec.name, service_stats_enabled(s), s->calls,
694                         s->cycles_spent, s->cycles_spent / calls);
695
696         if (reset) {
697                 s->cycles_spent = 0;
698                 s->calls = 0;
699         }
700 }
701
702 static void
703 service_dump_calls_per_lcore(FILE *f, uint32_t lcore, uint32_t reset)
704 {
705         uint32_t i;
706         struct core_state *cs = &lcore_states[lcore];
707
708         fprintf(f, "%02d\t", lcore);
709         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
710                 if (!service_valid(i))
711                         continue;
712                 fprintf(f, "%"PRIu64"\t", cs->calls_per_service[i]);
713                 if (reset)
714                         cs->calls_per_service[i] = 0;
715         }
716         fprintf(f, "\n");
717 }
718
719 int32_t rte_service_dump(FILE *f, uint32_t id)
720 {
721         uint32_t i;
722         int print_one = (id != UINT32_MAX);
723
724         uint64_t total_cycles = 0;
725
726         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
727                 if (!service_valid(i))
728                         continue;
729                 total_cycles += rte_services[i].cycles_spent;
730         }
731
732         /* print only the specified service */
733         if (print_one) {
734                 struct rte_service_spec_impl *s;
735                 SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
736                 fprintf(f, "Service %s Summary\n", s->spec.name);
737                 uint32_t reset = 0;
738                 rte_service_dump_one(f, s, total_cycles, reset);
739                 return 0;
740         }
741
742         /* print all services, as UINT32_MAX was passed as id */
743         fprintf(f, "Services Summary\n");
744         for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
745                 if (!service_valid(i))
746                         continue;
747                 uint32_t reset = 1;
748                 rte_service_dump_one(f, &rte_services[i], total_cycles, reset);
749         }
750
751         fprintf(f, "Service Cores Summary\n");
752         for (i = 0; i < RTE_MAX_LCORE; i++) {
753                 if (lcore_config[i].core_role != ROLE_SERVICE)
754                         continue;
755
756                 uint32_t reset = 1;
757                 service_dump_calls_per_lcore(f, i, reset);
758         }
759
760         return 0;
761 }