Skip to content

Commit

Permalink
examples/service_cores: check cores before run
Browse files Browse the repository at this point in the history
The service core samples has varied profiles created to run on specified
lcore count. The patch adds the check before each run, to ensure
example has sufficent lcores to be added as service cores on given run
profile. If sufficent cores are not found, the run is skipped with user
notification.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  • Loading branch information
vvarghes authored and tmonjalo committed Oct 29, 2018
1 parent 23021f1 commit 7f6ee6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/service_cores/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7f6ee6a

Please sign in to comment.