[dpdk-dev] [RFC 02/10] eal: make --no-shconf an alias for --no-shared-files

Anatoly Burakov anatoly.burakov at intel.com
Thu May 31 16:32:25 CEST 2018


Move all functionality associated with --no-shconf to
--no-shared-files, and make the former an alias for the latter.

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/librte_eal/bsdapp/eal/eal.c            |  4 ++--
 lib/librte_eal/common/eal_common_memory.c  |  3 ++-
 lib/librte_eal/common/eal_common_options.c |  8 ++------
 lib/librte_eal/common/eal_internal_cfg.h   |  1 -
 lib/librte_eal/common/eal_options.h        |  2 +-
 lib/librte_eal/linuxapp/eal/eal.c          |  6 +++---
 test/test/test_eal_flags.c                 | 18 +++++++++---------
 7 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index dc279542d..4dff1804e 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -222,7 +222,7 @@ rte_eal_config_create(void)
 
 	const char *pathname = eal_runtime_config_path();
 
-	if (internal_config.no_shconf)
+	if (internal_config.no_shared_files)
 		return;
 
 	if (mem_cfg_fd < 0){
@@ -261,7 +261,7 @@ rte_eal_config_attach(void)
 	void *rte_mem_cfg_addr;
 	const char *pathname = eal_runtime_config_path();
 
-	if (internal_config.no_shconf)
+	if (internal_config.no_shared_files)
 		return;
 
 	if (mem_cfg_fd < 0){
diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 4f0688f9d..a9c4b9b68 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -938,7 +938,8 @@ rte_eal_memory_init(void)
 	if (retval < 0)
 		goto fail;
 
-	if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
+	if (internal_config.no_shared_files == 0 &&
+			rte_eal_memdevice_init() < 0)
 		goto fail;
 
 	return 0;
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 38df094de..0f3eb928a 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -65,7 +65,7 @@ eal_long_options[] = {
 	{OPT_NO_HPET,           0, NULL, OPT_NO_HPET_NUM          },
 	{OPT_NO_HUGE,           0, NULL, OPT_NO_HUGE_NUM          },
 	{OPT_NO_PCI,            0, NULL, OPT_NO_PCI_NUM           },
-	{OPT_NO_SHCONF,         0, NULL, OPT_NO_SHCONF_NUM        },
+	{OPT_NO_SHCONF,         0, NULL, OPT_NO_SHARED_FILES_NUM  },
 	{OPT_NO_SHARED_FILES,   0, NULL, OPT_NO_SHARED_FILES_NUM  },
 	{OPT_PCI_BLACKLIST,     1, NULL, OPT_PCI_BLACKLIST_NUM    },
 	{OPT_PCI_WHITELIST,     1, NULL, OPT_PCI_WHITELIST_NUM    },
@@ -1162,10 +1162,6 @@ eal_parse_common_option(int opt, const char *optarg,
 		conf->vmware_tsc_map = 1;
 		break;
 
-	case OPT_NO_SHCONF_NUM:
-		conf->no_shconf = 1;
-		break;
-
 	case OPT_NO_SHARED_FILES_NUM:
 		conf->no_shared_files = 1;
 		break;
@@ -1382,6 +1378,6 @@ eal_common_usage(void)
 	       "  --"OPT_NO_HUGE"           Use malloc instead of hugetlbfs\n"
 	       "  --"OPT_NO_PCI"            Disable PCI\n"
 	       "  --"OPT_NO_HPET"           Disable HPET\n"
-	       "  --"OPT_NO_SHCONF"         No shared config (mmap'd files)\n"
+	       "  --"OPT_NO_SHCONF"         Deprecated. Alias for --no-shared-files\n"
 	       "\n", RTE_MAX_LCORE);
 }
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index 3fc71bb49..d80bacd4d 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -40,7 +40,6 @@ struct internal_config {
 	volatile unsigned no_hpet;        /**< true to disable HPET */
 	volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
 										* instead of native TSC */
-	volatile unsigned no_shconf;      /**< true if there is no shared config */
 	volatile unsigned no_shared_files; /**< true if there are no shared files to be created*/
 	volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */
 	volatile enum rte_proc_type_t process_type; /**< multi-process proc type */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index b0d9d6819..6890d4114 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -43,8 +43,8 @@ enum {
 	OPT_NO_HUGE_NUM,
 #define OPT_NO_PCI            "no-pci"
 	OPT_NO_PCI_NUM,
+/* no-shconf is an alias for no-shared-files */
 #define OPT_NO_SHCONF         "no-shconf"
-	OPT_NO_SHCONF_NUM,
 #define OPT_NO_SHARED_FILES   "no-shared-files"
 	OPT_NO_SHARED_FILES_NUM,
 #define OPT_SOCKET_MEM        "socket-mem"
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 8655b8691..32ca25dc2 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -230,7 +230,7 @@ rte_eal_config_create(void)
 
 	const char *pathname = eal_runtime_config_path();
 
-	if (internal_config.no_shconf)
+	if (internal_config.no_shared_files)
 		return;
 
 	/* map the config before hugepage address so that we don't waste a page */
@@ -283,7 +283,7 @@ rte_eal_config_attach(void)
 
 	const char *pathname = eal_runtime_config_path();
 
-	if (internal_config.no_shconf)
+	if (internal_config.no_shared_files)
 		return;
 
 	if (mem_cfg_fd < 0){
@@ -309,7 +309,7 @@ rte_eal_config_reattach(void)
 	struct rte_mem_config *mem_config;
 	void *rte_mem_cfg_addr;
 
-	if (internal_config.no_shconf)
+	if (internal_config.no_shared_files)
 		return;
 
 	/* save the address primary process has mapped shared config to */
diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c
index f840ca50b..8e83ea7bf 100644
--- a/test/test/test_eal_flags.c
+++ b/test/test/test_eal_flags.c
@@ -27,7 +27,7 @@
 #define mp_flag "--proc-type=secondary"
 #define no_hpet "--no-hpet"
 #define no_huge "--no-huge"
-#define no_shconf "--no-shconf"
+#define no_shared_files "--no-shared-files"
 #define pci_whitelist "--pci-whitelist"
 #define vdev "--vdev"
 #define memtest "memtest"
@@ -370,7 +370,7 @@ test_invalid_vdev_flag(void)
 #ifdef RTE_EXEC_ENV_BSDAPP
 	/* BSD target doesn't support prefixes at this point, and we also need to
 	 * run another primary process here */
-	const char * prefix = no_shconf;
+	const char * prefix = no_shared_files;
 #else
 	const char * prefix = "--file-prefix=vdev";
 #endif
@@ -662,15 +662,15 @@ test_invalid_n_flag(void)
 #endif
 
 	/* -n flag but no value */
-	const char *argv1[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n"};
+	const char *argv1[] = { prgname, prefix, no_huge, no_shared_files, "-c", "1", "-n"};
 	/* bad numeric value */
-	const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" };
+	const char *argv2[] = { prgname, prefix, no_huge, no_shared_files, "-c", "1", "-n", "e" };
 	/* zero is invalid */
-	const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "0" };
+	const char *argv3[] = { prgname, prefix, no_huge, no_shared_files, "-c", "1", "-n", "0" };
 	/* sanity test - check with good value */
-	const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" };
+	const char *argv4[] = { prgname, prefix, no_huge, no_shared_files, "-c", "1", "-n", "2" };
 	/* sanity test - check with no -n flag */
-	const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};
+	const char *argv5[] = { prgname, prefix, no_huge, no_shared_files, "-c", "1"};
 
 	if (launch_proc(argv1) == 0
 			|| launch_proc(argv2) == 0
@@ -734,7 +734,7 @@ test_no_huge_flag(void)
 #ifdef RTE_EXEC_ENV_BSDAPP
 	/* BSD target doesn't support prefixes at this point, and we also need to
 	 * run another primary process here */
-	const char * prefix = no_shconf;
+	const char * prefix = no_shared_files;
 #else
 	const char * prefix = "--file-prefix=nohuge";
 #endif
@@ -851,7 +851,7 @@ test_misc_flags(void)
 	const char *argv5[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog", "error"};
 	/* With no-sh-conf */
 	const char *argv6[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE,
-			no_shconf, nosh_prefix };
+			no_shared_files, nosh_prefix };
 
 #ifdef RTE_EXEC_ENV_BSDAPP
 	return 0;
-- 
2.17.0


More information about the dev mailing list