summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2019-08-21 10:12:52 +0100
committerDavid Marchand <david.marchand@redhat.com>2019-10-15 20:37:11 +0200
commita8f8ae1cf9b68f6398b49019ca07a215a57bba41 (patch)
treef606a433ecc475c296c1281ce71d135e3f7f53fa
parent75dbb45f28af31f49617d93e0195daa76df1724c (diff)
downloaddpdk-next-eventdev-a8f8ae1cf9b68f6398b49019ca07a215a57bba41.zip
dpdk-next-eventdev-a8f8ae1cf9b68f6398b49019ca07a215a57bba41.tar.gz
dpdk-next-eventdev-a8f8ae1cf9b68f6398b49019ca07a215a57bba41.tar.xz
service: use log for error messages
EAL should always use rte_log instead of putting errors to stderr (which maybe redirected to /dev/null in a daemon). Also checks for null before rte_free are unnecessary. Minor code consistency improvements. Fixes: 21698354c832 ("service: introduce service cores concept") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
-rw-r--r--lib/librte_eal/common/rte_service.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index c3653eb..fe09077 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -70,10 +70,12 @@ static struct rte_service_spec_impl *rte_services;
static struct core_state *lcore_states;
static uint32_t rte_service_library_initialized;
-int32_t rte_service_init(void)
+int32_t
+rte_service_init(void)
{
if (rte_service_library_initialized) {
- printf("service library init() called, init flag %d\n",
+ RTE_LOG(NOTICE, EAL,
+ "service library init() called, init flag %d\n",
rte_service_library_initialized);
return -EALREADY;
}
@@ -82,14 +84,14 @@ int32_t rte_service_init(void)
sizeof(struct rte_service_spec_impl),
RTE_CACHE_LINE_SIZE);
if (!rte_services) {
- printf("error allocating rte services array\n");
+ RTE_LOG(ERR, EAL, "error allocating rte services array\n");
goto fail_mem;
}
lcore_states = rte_calloc("rte_service_core_states", RTE_MAX_LCORE,
sizeof(struct core_state), RTE_CACHE_LINE_SIZE);
if (!lcore_states) {
- printf("error allocating core states array\n");
+ RTE_LOG(ERR, EAL, "error allocating core states array\n");
goto fail_mem;
}
@@ -108,10 +110,8 @@ int32_t rte_service_init(void)
rte_service_library_initialized = 1;
return 0;
fail_mem:
- if (rte_services)
- rte_free(rte_services);
- if (lcore_states)
- rte_free(lcore_states);
+ rte_free(rte_services);
+ rte_free(lcore_states);
return -ENOMEM;
}
@@ -121,11 +121,8 @@ rte_service_finalize(void)
if (!rte_service_library_initialized)
return;
- if (rte_services)
- rte_free(rte_services);
-
- if (lcore_states)
- rte_free(lcore_states);
+ rte_free(rte_services);
+ rte_free(lcore_states);
rte_service_library_initialized = 0;
}
@@ -397,8 +394,8 @@ rte_service_may_be_active(uint32_t id)
return 0;
}
-int32_t rte_service_run_iter_on_app_lcore(uint32_t id,
- uint32_t serialize_mt_unsafe)
+int32_t
+rte_service_run_iter_on_app_lcore(uint32_t id, uint32_t serialize_mt_unsafe)
{
/* run service on calling core, using all-ones as the service mask */
if (!service_valid(id))