Re: Application framework vs. library
From: <hidden>
Date: 2016-08-01 09:22:47
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index bd770cf..f63f2f8 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c@@ -664,12 +664,6 @@ eal_check_mem_on_local_socket(void) "memory on local socket!\n"); } -static int -sync_func(__attribute__((unused)) void *arg) -{ - return 0; -} - inline static void rte_eal_mcfg_complete(void) {
@@ -699,26 +693,17 @@ rte_eal_iopl_init(void) int rte_eal_init(int argc, char **argv) { - int i, fctret, ret; - pthread_t thread_id; - static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0); + int fctret; struct shared_driver *solib = NULL; const char *logid; - char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - - if (!rte_atomic32_test_and_set(&run_once)) - return -1; - logid = strrchr(argv[0], '/'); - logid = strdup(logid ? logid + 1: argv[0]); - - thread_id = pthread_self(); + logid = NULL; if (rte_eal_log_early_init() < 0) - rte_panic("Cannot init early logs\n"); + return -1; if (rte_eal_cpu_init() < 0) - rte_panic("Cannot detect lcores\n"); + return -1; fctret = eal_parse_args(argc, argv); if (fctret < 0)
@@ -731,7 +716,7 @@ rte_eal_init(int argc, char **argv) internal_config.process_type != RTE_PROC_SECONDARY
&&
internal_config.xen_dom0_support == 0 &&
eal_hugepage_info_init() < 0)
- rte_panic("Cannot get hugepage information\n");
+ return -1;
if (internal_config.memory == 0 && internal_config.force_sockets
== 0) {
if (internal_config.no_hugetlbfs)@@ -756,41 +741,43 @@ rte_eal_init(int argc, char **argv) rte_config_init(); if (rte_eal_pci_init() < 0) - rte_panic("Cannot init PCI\n"); + return -1; #ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_init() < 0) - rte_panic("Cannot init IVSHMEM\n"); + return -1; #endif if (rte_eal_memory_init() < 0) - rte_panic("Cannot init memory\n"); + return -1; /* the directories are locked during eal_hugepage_info_init */ eal_hugedirs_unlock(); if (rte_eal_memzone_init() < 0) - rte_panic("Cannot init memzone\n"); + return -1; if (rte_eal_tailqs_init() < 0) - rte_panic("Cannot init tail queues for objects\n"); + return -1; #ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_obj_init() < 0) - rte_panic("Cannot init IVSHMEM objects\n"); + return -1; #endif if (rte_eal_log_init(logid, internal_config.syslog_facility) < 0) - rte_panic("Cannot init logs\n"); + return -1; if (rte_eal_alarm_init() < 0) - rte_panic("Cannot init interrupt-handling thread\n"); + return -1; + /* interrupt handling will be initialized but the thread is
patched to immediately exit */
if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
+ return -1;
+ /* timer stuff is initialized but hpet should be disabled in
configuration */
if (rte_eal_timer_init() < 0)
- rte_panic("Cannot init HPET or TSC timers\n");
+ return -1;
eal_check_mem_on_local_socket();
@@ -803,47 +790,12 @@ rte_eal_init(int argc, char **argv) RTE_LOG(WARNING, EAL, "%s\n", dlerror()); } - eal_thread_init_master(rte_config.master_lcore); - - ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN); - - RTE_LOG(DEBUG, EAL, "Master lcore %u is ready
(tid=%x;cpuset=[%s%s])\n",
- rte_config.master_lcore, (int)thread_id, cpuset,
- ret == 0 ? "" : "...");
-
if (rte_eal_dev_init() < 0)
- rte_panic("Cannot init pmd devices\n");
-
- RTE_LCORE_FOREACH_SLAVE(i) {
-
- /*
- * create communication pipes between master thread
- * and children
- */
- if (pipe(lcore_config[i].pipe_master2slave) < 0)
- rte_panic("Cannot create pipe\n");
- if (pipe(lcore_config[i].pipe_slave2master) < 0)
- rte_panic("Cannot create pipe\n");
-
- lcore_config[i].state = WAIT;
-
- /* create a thread for each lcore */
- ret = pthread_create(&lcore_config[i].thread_id, NULL,
- eal_thread_loop, NULL);
- if (ret != 0)
- rte_panic("Cannot create thread\n");
- }
-
- /*
- * Launch a dummy function on all slave lcores, so that master
lcore
- * knows they are all ready when this function returns.
- */
- rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
- rte_eal_mp_wait_lcore();
+ return -1;
/* Probe & Initialize PCI devices */
if (rte_eal_pci_probe())
- rte_panic("Cannot probe PCI\n");
+ return -1;
return fctret;
}diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 66deda2..886e5e0 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c@@ -774,6 +774,9 @@ eal_intr_thread_main(__rte_unused void *arg) { struct epoll_event ev; + /* we do not need the interrupt handling and do not want the extra
thread */
+ pthread_exit((void*)0);
+
/* host thread, never break out */
for (;;) {
/* build up the epoll fd with all descriptors we are todiff --git a/lib/librte_eal/linuxapp/eal/eal_log.c b/lib/librte_eal/linuxapp/eal/eal_log.c index 0b133c3..7c4d569 100644
--- a/lib/librte_eal/linuxapp/eal/eal_log.c
+++ b/lib/librte_eal/linuxapp/eal/eal_log.c@@ -91,7 +91,7 @@ static cookie_io_functions_t console_log_func = { * once memzones are available. */ int -rte_eal_log_init(const char *id, int facility) +rte_eal_log_init(__attribute__((unused)) const char *id,
__attribute__((unused)) int facility)
{
FILE *log_stream;
@@ -99,8 +99,6 @@ rte_eal_log_init(const char *id, int facility) if (log_stream == NULL) return -1; - openlog(id, LOG_NDELAY | LOG_PID, facility); - if (rte_eal_common_log_init(log_stream) < 0) return -1;
--
Steffen Bauch
Senior Software Engineer Platform & Technology
R&S Cybersecurity ipoque GmbH
Augustusplatz 9, D-04109 Leipzig
Phone: + 49 341 59403 0
Email: steffen.bauch@rohde-schwarz.com
Internet: www.ipoque.com
Trade register Amtsgericht Leipzig HRB21462
Gesellschaft mit beschränkter Haftung (GmbH)
Dirk Czepluch - Managing Director