From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 04/10] eal: factorize internal config reset
Date: Sat, 22 Nov 2014 22:43:36 +0100 [thread overview]
Message-ID: <1416692622-28886-5-git-send-email-thomas.monjalon@6wind.com> (raw)
In-Reply-To: <1416692622-28886-1-git-send-email-thomas.monjalon@6wind.com>
Now that internal config structure is common to Linux and BSD,
we can have a common function to initialize it.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal.c | 24 +------------------
lib/librte_eal/common/eal_common_options.c | 37 ++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_internal_cfg.h | 2 ++
lib/librte_eal/linuxapp/eal/eal.c | 28 +---------------------
4 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index ca99cb9..391ce53 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -321,29 +321,7 @@ eal_parse_args(int argc, char **argv)
argvopt = argv;
- internal_config.memory = 0;
- internal_config.force_nrank = 0;
- internal_config.force_nchannel = 0;
- internal_config.hugefile_prefix = HUGEFILE_PREFIX_DEFAULT;
- internal_config.hugepage_dir = NULL;
- internal_config.force_sockets = 0;
- internal_config.syslog_facility = LOG_DAEMON;
- /* default value from build option */
- internal_config.log_level = RTE_LOG_LEVEL;
-#ifdef RTE_LIBEAL_USE_HPET
- internal_config.no_hpet = 0;
-#else
- internal_config.no_hpet = 1;
-#endif
- /* zero out the NUMA config */
- for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
- internal_config.socket_mem[i] = 0;
-
- /* zero out hugedir descriptors */
- for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
- internal_config.hugepage_info[i].lock_descriptor = 0;
-
- internal_config.vmware_tsc_map = 0;
+ eal_reset_internal_config(&internal_config);
while ((opt = getopt_long(argc, argvopt, eal_short_options,
eal_long_options, &option_index)) != EOF) {
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 7a5d55e..ffc615a 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -47,6 +47,7 @@
#include "eal_internal_cfg.h"
#include "eal_options.h"
+#include "eal_filesystem.h"
#define BITS_PER_HEX 4
@@ -84,6 +85,42 @@ eal_long_options[] = {
{0, 0, 0, 0}
};
+void
+eal_reset_internal_config(struct internal_config *internal_cfg)
+{
+ int i;
+
+ internal_cfg->memory = 0;
+ internal_cfg->force_nrank = 0;
+ internal_cfg->force_nchannel = 0;
+ internal_cfg->hugefile_prefix = HUGEFILE_PREFIX_DEFAULT;
+ internal_cfg->hugepage_dir = NULL;
+ internal_cfg->force_sockets = 0;
+ /* zero out the NUMA config */
+ for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
+ internal_cfg->socket_mem[i] = 0;
+ /* zero out hugedir descriptors */
+ for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
+ internal_cfg->hugepage_info[i].lock_descriptor = -1;
+ internal_cfg->base_virtaddr = 0;
+
+ internal_cfg->syslog_facility = LOG_DAEMON;
+ /* default value from build option */
+ internal_cfg->log_level = RTE_LOG_LEVEL;
+
+ internal_cfg->xen_dom0_support = 0;
+
+ /* if set to NONE, interrupt mode is determined automatically */
+ internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE;
+
+#ifdef RTE_LIBEAL_USE_HPET
+ internal_cfg->no_hpet = 0;
+#else
+ internal_cfg->no_hpet = 1;
+#endif
+ internal_cfg->vmware_tsc_map = 0;
+}
+
/*
* Parse the coremask given as argument (hexadecimal string) and fill
* the global configuration (core role and core count) with the parsed
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index 19c84e7..a80aeab 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -88,4 +88,6 @@ struct internal_config {
};
extern struct internal_config internal_config; /**< Global EAL configuration. */
+void eal_reset_internal_config(struct internal_config *internal_cfg);
+
#endif
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 7a1d087..bb35669 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -513,33 +513,7 @@ eal_parse_args(int argc, char **argv)
argvopt = argv;
- internal_config.memory = 0;
- internal_config.force_nrank = 0;
- internal_config.force_nchannel = 0;
- internal_config.hugefile_prefix = HUGEFILE_PREFIX_DEFAULT;
- internal_config.hugepage_dir = NULL;
- internal_config.force_sockets = 0;
- internal_config.syslog_facility = LOG_DAEMON;
- /* default value from build option */
- internal_config.log_level = RTE_LOG_LEVEL;
- internal_config.xen_dom0_support = 0;
- /* if set to NONE, interrupt mode is determined automatically */
- internal_config.vfio_intr_mode = RTE_INTR_MODE_NONE;
-#ifdef RTE_LIBEAL_USE_HPET
- internal_config.no_hpet = 0;
-#else
- internal_config.no_hpet = 1;
-#endif
- /* zero out the NUMA config */
- for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
- internal_config.socket_mem[i] = 0;
-
- /* zero out hugedir descriptors */
- for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
- internal_config.hugepage_info[i].lock_descriptor = -1;
-
- internal_config.vmware_tsc_map = 0;
- internal_config.base_virtaddr = 0;
+ eal_reset_internal_config(&internal_config);
while ((opt = getopt_long(argc, argvopt, eal_short_options,
eal_long_options, &option_index)) != EOF) {
--
2.1.3
next prev parent reply other threads:[~2014-11-22 21:33 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-22 21:43 [dpdk-dev] [PATCH 00/10] eal cleanup and new options Thomas Monjalon
2014-11-22 21:43 ` [dpdk-dev] [PATCH 01/10] eal: move internal headers in source directory Thomas Monjalon
2014-11-25 10:21 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 02/10] eal: factorize common headers Thomas Monjalon
2014-11-25 10:23 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 03/10] eal: fix header guards Thomas Monjalon
2014-11-25 10:28 ` Bruce Richardson
2014-11-25 12:23 ` Thomas Monjalon
2014-11-25 13:37 ` Bruce Richardson
2014-11-22 21:43 ` Thomas Monjalon [this message]
2014-11-25 10:30 ` [dpdk-dev] [PATCH 04/10] eal: factorize internal config reset Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 05/10] eal: factorize options sanity check Thomas Monjalon
2014-11-25 10:42 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 06/10] eal: factorize configuration adjustment Thomas Monjalon
2014-11-25 10:44 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 07/10] eal: add core list input format Thomas Monjalon
2014-11-23 1:35 ` Neil Horman
2014-11-24 11:28 ` Bruce Richardson
2014-11-24 13:19 ` Thomas Monjalon
2014-11-24 13:28 ` Bruce Richardson
2014-11-24 13:37 ` Burakov, Anatoly
2014-11-24 14:01 ` Neil Horman
2014-11-24 14:52 ` Venkatesan, Venky
2014-11-24 16:12 ` Roger Keith Wiles
2014-11-24 17:04 ` Neil Horman
2014-11-24 17:09 ` Roger Keith Wiles
2014-11-24 17:11 ` Burakov, Anatoly
2014-11-24 17:17 ` Neil Horman
2014-11-25 10:45 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 08/10] config: support 128 cores Thomas Monjalon
2014-11-25 10:46 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 09/10] eal: get relative core index Thomas Monjalon
2014-11-25 10:51 ` Bruce Richardson
2014-11-22 21:43 ` [dpdk-dev] [PATCH 10/10] eal: add option --master-lcore Thomas Monjalon
2014-11-25 9:09 ` Simon Kuenzer
2014-11-25 12:45 ` Thomas Monjalon
2014-11-25 13:39 ` Bruce Richardson
2014-11-26 10:34 ` Simon Kuenzer
2014-11-25 14:55 ` [dpdk-dev] [PATCH 00/10] eal cleanup and new options Thomas Monjalon
2014-11-25 15:06 ` Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416692622-28886-5-git-send-email-thomas.monjalon@6wind.com \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).