service: fix loops to always scan all services
authorHarry van Haaren <harry.van.haaren@intel.com>
Mon, 21 Aug 2017 12:58:10 +0000 (13:58 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 15 Sep 2017 11:46:41 +0000 (13:46 +0200)
commit2a9549ca3b5b3a5233c6f2a1fe5953b62f39d680
treea307fea72147199a01b82d9d70c4341fb42e04e3
parent3cf5eb1546ed83ee1b5c3fe8ca9d5274ffe4bd59
service: fix loops to always scan all services

Services can be registered and unregistered, and "holes" can
appear in the contiguous array of services if a service is
unregistered. As a result, we must never iterate to the
number of services (as counted by rte_service_count), instead
scanning the service array and checking if the service is valid.

After this commit, the rte_service_count variable is only used
for its intended purpose; tracking the number of services that
are present.

Fixes: 21698354c832 ("service: introduce service cores concept")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
lib/librte_eal/common/rte_service.c