From: Pavan Nikhilesh Date: Tue, 9 Jan 2018 09:40:41 +0000 (+0530) Subject: service: fix number mapped cores count X-Git-Tag: spdx-start~737 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=088a05f057d68ad48fe6788bb276d5d4bd151fb1;p=dpdk.git service: fix number mapped cores count When adding service the number of mapped cores should only be incremented when the core is not already a service core or vice versa. Fixes: 21698354c832 ("service: introduce service cores concept") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren --- diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 372d0bbb3f..c51765833f 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -516,10 +516,14 @@ service_update(struct rte_service_spec *service, uint32_t lcore, uint64_t sid_mask = UINT64_C(1) << sid; if (set) { - if (*set) { + uint64_t lcore_mapped = lcore_states[lcore].service_mask & + sid_mask; + + if (*set && !lcore_mapped) { lcore_states[lcore].service_mask |= sid_mask; rte_atomic32_inc(&rte_services[sid].num_mapped_cores); - } else { + } + if (!*set && lcore_mapped) { lcore_states[lcore].service_mask &= ~(sid_mask); rte_atomic32_dec(&rte_services[sid].num_mapped_cores); }