bus/fslmc: update MC FW to 10.28
[dpdk.git] / examples / service_cores / main.c
index 2cd5729..9f52082 100644 (file)
@@ -118,6 +118,12 @@ apply_profile(int profile_id)
        struct profile *p = &profiles[profile_id];
        const uint8_t core_off = 1;
 
+       if (p->num_cores > rte_lcore_count() - 1) {
+               printf("insufficent cores to run (%s)",
+                       p->name);
+               return;
+       }
+
        for (i = 0; i < p->num_cores; i++) {
                uint32_t core = i + core_off;
                ret = rte_service_lcore_add(core);
@@ -170,6 +176,7 @@ main(int argc, char **argv)
        for (i = 0; i < NUM_SERVICES; i++) {
                services[i].callback_userdata = 0;
                uint32_t id;
+               /* Register a service as an application. 8< */
                ret = rte_service_component_register(&services[i], &id);
                if (ret)
                        rte_exit(-1, "service register() failed");
@@ -192,6 +199,7 @@ main(int argc, char **argv)
                ret = rte_service_runstate_set(id, 1);
                if (ret)
                        return -ENOEXEC;
+               /* >8 End of registering a service as an application. */
        }
 
        i = 0;
@@ -203,10 +211,10 @@ main(int argc, char **argv)
                apply_profile(i);
                printf("\n==> Profile: %s\n\n", profiles[i].name);
 
-               sleep(1);
+               rte_delay_us_sleep(1 * US_PER_S);
                rte_service_dump(stdout, UINT32_MAX);
 
-               sleep(5);
+               rte_delay_us_sleep(5 * US_PER_S);
                rte_service_dump(stdout, UINT32_MAX);
 
                i++;
@@ -214,5 +222,8 @@ main(int argc, char **argv)
                        i = 0;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }