diff options
Diffstat (limited to 'examples/performance-thread/common/lthread_sched.c')
-rw-r--r-- | examples/performance-thread/common/lthread_sched.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c index 98291478..779aeb17 100644 --- a/examples/performance-thread/common/lthread_sched.c +++ b/examples/performance-thread/common/lthread_sched.c @@ -117,8 +117,7 @@ uint64_t diag_mask; /* constructor */ -void lthread_sched_ctor(void) __attribute__ ((constructor)); -void lthread_sched_ctor(void) +RTE_INIT(lthread_sched_ctor) { memset(schedcore, 0, sizeof(schedcore)); rte_atomic16_init(&num_schedulers); @@ -562,11 +561,14 @@ void lthread_run(void) * Return the scheduler for this lcore * */ -struct lthread_sched *_lthread_sched_get(int lcore_id) +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id) { - if (lcore_id > LTHREAD_MAX_LCORES) - return NULL; - return schedcore[lcore_id]; + struct lthread_sched *res = NULL; + + if (lcore_id < LTHREAD_MAX_LCORES) + res = schedcore[lcore_id]; + + return res; } /* @@ -578,10 +580,9 @@ int lthread_set_affinity(unsigned lcoreid) struct lthread *lt = THIS_LTHREAD; struct lthread_sched *dest_sched; - if (unlikely(lcoreid > LTHREAD_MAX_LCORES)) + if (unlikely(lcoreid >= LTHREAD_MAX_LCORES)) return POSIX_ERRNO(EINVAL); - DIAG_EVENT(lt, LT_DIAG_LTHREAD_AFFINITY, lcoreid, 0); dest_sched = schedcore[lcoreid]; |