get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2179/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2179,
    "url": "https://patches.dpdk.org/api/patches/2179/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1419957440-11767-3-git-send-email-rkerur@gmail.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1419957440-11767-3-git-send-email-rkerur@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1419957440-11767-3-git-send-email-rkerur@gmail.com",
    "date": "2014-12-30T16:37:17",
    "name": "[dpdk-dev,v3,3/6] Move common functions in eal.c",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "213d64eaba87ec858f6602e371b8da0cd20dfd9f",
    "submitter": {
        "id": 134,
        "url": "https://patches.dpdk.org/api/people/134/?format=api",
        "name": "Ravi Kerur",
        "email": "rkerur@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1419957440-11767-3-git-send-email-rkerur@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2179/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2179/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 63DF95A2F;\n\tTue, 30 Dec 2014 17:37:49 +0100 (CET)",
            "from mail-pd0-f169.google.com (mail-pd0-f169.google.com\n\t[209.85.192.169]) by dpdk.org (Postfix) with ESMTP id 2B3B55A08\n\tfor <dev@dpdk.org>; Tue, 30 Dec 2014 17:37:43 +0100 (CET)",
            "by mail-pd0-f169.google.com with SMTP id z10so19450292pdj.14\n\tfor <dev@dpdk.org>; Tue, 30 Dec 2014 08:37:42 -0800 (PST)",
            "from iaas-l305162.englab.brocade.com ([144.49.130.148])\n\tby mx.google.com with ESMTPSA id\n\tpb6sm38901162pbb.13.2014.12.30.08.37.41\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 30 Dec 2014 08:37:42 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Sse/dUQI/2fiHwM+Ao9lO9t9ARTNwS01sgjnaDZVAf8=;\n\tb=PefYD2vWcqOI9F/8gO2J3Vz+d5PutgFqFylRElNVuang5kzbGlp8sHNJECh2LcYSAP\n\tdNa/K8Qzj5TA0fsf1C/TwFFknvWZKa8uojmm5eqtx6IXVh97x3na3Ahu7akrn6aofz5q\n\tlC/oqYB1hgJrUSmKnn3MPRlnMjfFIjvnxzVMrXQ+3Crs03Ho4NrgVLI9oEFJRsfcrEbd\n\tZuNAjsd4P9602k02nX9WiBpx96PrLppI+Il0o2mnABkdg6Ts9PnXFmRvv1/eRFQtSjje\n\taCjDhVInPI9QNTeE9InAFUn3P+KJIh1bS/6tvkUf5FN5TIbU0oHYaSg2dRCHt5XRtxvt\n\tfmWA==",
        "X-Received": "by 10.70.130.73 with SMTP id oc9mr99798278pdb.42.1419957462432; \n\tTue, 30 Dec 2014 08:37:42 -0800 (PST)",
        "From": "Ravi Kerur <rkerur@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 30 Dec 2014 11:37:17 -0500",
        "Message-Id": "<1419957440-11767-3-git-send-email-rkerur@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1419957440-11767-1-git-send-email-rkerur@gmail.com>",
        "References": "<1419957384-11693-1-git-send-email-rkerur@gmail.com>\n\t<1419957440-11767-1-git-send-email-rkerur@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/6] Move common functions in eal.c",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Changes in v3\nChanged subject line to explicitly include file name\nCommit log includes function names moved to common directory.\n\nChanges in v2\nIn function rte_eal_config_create remove #ifdef _BSDAPP_\nand initialize mem_cfg_addr unconditionally.\n\nChanges in v1\nMove common functions in eal.c to librte_eal/common/eal_common.c.\n\nFollowing functions are moved to eal_common.c file.\n\nstruct rte_config *rte_eal_get_configuration(void);\nint eal_parse_sysfs_value(const char *filename, unsigned long *val);\nstatic void rte_eal_config_create(void);\nenum rte_proc_type_t eal_proc_type_detect(void);\nvoid rte_eal_config_init(void);\nrte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func);\ninline size_t eal_get_hugepage_mem_size(void);\nvoid eal_check_mem_on_local_socket(void);\nint sync_func(__attribute__((unused)) void *arg);\ninline void rte_eal_mcfg_complete(void);\nint rte_eal_has_hugepages(void);\nenum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id);\nenum rte_proc_type_t rte_eal_process_type(void);\n\nMakefile changes to reflect new file added.\nFix checkpatch warnings and errors.\n\nSigned-off-by: Ravi Kerur <rkerur@gmail.com>\n---\n lib/librte_eal/bsdapp/eal/Makefile    |   1 +\n lib/librte_eal/bsdapp/eal/eal.c       | 233 +-----------------------\n lib/librte_eal/common/eal_common.c    | 326 ++++++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_externs.h   |  42 +++++\n lib/librte_eal/common/eal_hugepages.h |   1 +\n lib/librte_eal/common/eal_private.h   |  47 +++++\n lib/librte_eal/linuxapp/eal/Makefile  |   1 +\n lib/librte_eal/linuxapp/eal/eal.c     | 246 ++-----------------------\n 8 files changed, 437 insertions(+), 460 deletions(-)\n create mode 100644 lib/librte_eal/common/eal_common.c\n create mode 100644 lib/librte_eal/common/eal_externs.h",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 92dd9a6..050d70b 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c\n \n # from common dir\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c\ndiff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 69f3c03..f925da7 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -80,30 +80,10 @@\n #include \"eal_filesystem.h\"\n #include \"eal_hugepages.h\"\n #include \"eal_options.h\"\n+#include \"eal_externs.h\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n \n-/* Allow the application to print its usage message too if set */\n-static rte_usage_hook_t\trte_application_usage_hook = NULL;\n-/* early configuration structure, when memory config is not mmapped */\n-static struct rte_mem_config early_mem_config;\n-\n-/* define fd variable here, because file needs to be kept open for the\n- * duration of the program, as we hold a write lock on it in the primary proc */\n-static int mem_cfg_fd = -1;\n-\n-static struct flock wr_lock = {\n-\t\t.l_type = F_WRLCK,\n-\t\t.l_whence = SEEK_SET,\n-\t\t.l_start = offsetof(struct rte_mem_config, memseg),\n-\t\t.l_len = sizeof(early_mem_config.memseg),\n-};\n-\n-/* Address of global and public configuration */\n-static struct rte_config rte_config = {\n-\t\t.mem_config = &early_mem_config,\n-};\n-\n /* internal configuration (per-core) */\n struct lcore_config lcore_config[RTE_MAX_LCORE];\n \n@@ -113,93 +93,14 @@ struct internal_config internal_config;\n /* used by rte_rdtsc() */\n int rte_cycles_vmware_tsc_map;\n \n-/* Return a pointer to the configuration structure */\n-struct rte_config *\n-rte_eal_get_configuration(void)\n+inline void *\n+rte_eal_get_mem_cfg_addr(void)\n {\n-\treturn &rte_config;\n-}\n-\n-/* parse a sysfs (or other) file containing one integer value */\n-int\n-eal_parse_sysfs_value(const char *filename, unsigned long *val)\n-{\n-\tFILE *f;\n-\tchar buf[BUFSIZ];\n-\tchar *end = NULL;\n-\n-\tif ((f = fopen(filename, \"r\")) == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open sysfs value %s\\n\",\n-\t\t\t__func__, filename);\n-\t\treturn -1;\n-\t}\n-\n-\tif (fgets(buf, sizeof(buf), f) == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot read sysfs value %s\\n\",\n-\t\t\t__func__, filename);\n-\t\tfclose(f);\n-\t\treturn -1;\n-\t}\n-\t*val = strtoul(buf, &end, 0);\n-\tif ((buf[0] == '\\0') || (end == NULL) || (*end != '\\n')) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot parse sysfs value %s\\n\",\n-\t\t\t\t__func__, filename);\n-\t\tfclose(f);\n-\t\treturn -1;\n-\t}\n-\tfclose(f);\n-\treturn 0;\n-}\n-\n-\n-/* create memory configuration in shared/mmap memory. Take out\n- * a write lock on the memsegs, so we can auto-detect primary/secondary.\n- * This means we never close the file while running (auto-close on exit).\n- * We also don't lock the whole file, so that in future we can use read-locks\n- * on other parts, e.g. memzones, to detect if there are running secondary\n- * processes. */\n-static void\n-rte_eal_config_create(void)\n-{\n-\tvoid *rte_mem_cfg_addr;\n-\tint retval;\n-\n-\tconst char *pathname = eal_runtime_config_path();\n-\n-\tif (internal_config.no_shconf)\n-\t\treturn;\n-\n-\tif (mem_cfg_fd < 0){\n-\t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);\n-\t\tif (mem_cfg_fd < 0)\n-\t\t\trte_panic(\"Cannot open '%s' for rte_mem_config\\n\", pathname);\n-\t}\n-\n-\tretval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));\n-\tif (retval < 0){\n-\t\tclose(mem_cfg_fd);\n-\t\trte_panic(\"Cannot resize '%s' for rte_mem_config\\n\", pathname);\n-\t}\n-\n-\tretval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);\n-\tif (retval < 0){\n-\t\tclose(mem_cfg_fd);\n-\t\trte_exit(EXIT_FAILURE, \"Cannot create lock on '%s'. Is another primary \"\n-\t\t\t\t\"process running?\\n\", pathname);\n-\t}\n-\n-\trte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),\n-\t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n-\n-\tif (rte_mem_cfg_addr == MAP_FAILED){\n-\t\trte_panic(\"Cannot mmap memory for rte_config\\n\");\n-\t}\n-\tmemcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));\n-\trte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;\n+\treturn NULL;\n }\n \n /* attach to an existing shared memory config */\n-static void\n+void\n rte_eal_config_attach(void)\n {\n \tvoid *rte_mem_cfg_addr;\n@@ -223,44 +124,11 @@ rte_eal_config_attach(void)\n \trte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;\n }\n \n-/* Detect if we are a primary or a secondary process */\n-enum rte_proc_type_t\n-eal_proc_type_detect(void)\n+/* NOP for BSD */\n+void\n+rte_eal_config_reattach(void)\n {\n-\tenum rte_proc_type_t ptype = RTE_PROC_PRIMARY;\n-\tconst char *pathname = eal_runtime_config_path();\n-\n-\t/* if we can open the file but not get a write-lock we are a secondary\n-\t * process. NOTE: if we get a file handle back, we keep that open\n-\t * and don't close it to prevent a race condition between multiple opens */\n-\tif (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&\n-\t\t\t(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))\n-\t\tptype = RTE_PROC_SECONDARY;\n-\n-\tRTE_LOG(INFO, EAL, \"Auto-detected process type: %s\\n\",\n-\t\t\tptype == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n \n-\treturn ptype;\n-}\n-\n-/* Sets up rte_config structure with the pointer to shared memory config.*/\n-static void\n-rte_config_init(void)\n-{\n-\trte_config.process_type = internal_config.process_type;\n-\n-\tswitch (rte_config.process_type){\n-\tcase RTE_PROC_PRIMARY:\n-\t\trte_eal_config_create();\n-\t\tbreak;\n-\tcase RTE_PROC_SECONDARY:\n-\t\trte_eal_config_attach();\n-\t\trte_eal_mcfg_wait_complete(rte_config.mem_config);\n-\t\tbreak;\n-\tcase RTE_PROC_AUTO:\n-\tcase RTE_PROC_INVALID:\n-\t\trte_panic(\"Invalid process type\\n\");\n-\t}\n }\n \n /* display usage */\n@@ -276,37 +144,6 @@ eal_usage(const char *prgname)\n \t}\n }\n \n-/* Set a per-application usage message */\n-rte_usage_hook_t\n-rte_set_application_usage_hook( rte_usage_hook_t usage_func )\n-{\n-\trte_usage_hook_t\told_func;\n-\n-\t/* Will be NULL on the first call to denote the last usage routine. */\n-\told_func\t\t\t\t\t= rte_application_usage_hook;\n-\trte_application_usage_hook\t= usage_func;\n-\n-\treturn old_func;\n-}\n-\n-static inline size_t\n-eal_get_hugepage_mem_size(void)\n-{\n-\tuint64_t size = 0;\n-\tunsigned i, j;\n-\n-\tfor (i = 0; i < internal_config.num_hugepage_sizes; i++) {\n-\t\tstruct hugepage_info *hpi = &internal_config.hugepage_info[i];\n-\t\tif (hpi->hugedir != NULL) {\n-\t\t\tfor (j = 0; j < RTE_MAX_NUMA_NODES; j++) {\n-\t\t\t\tsize += hpi->hugepage_sz * hpi->num_pages[j];\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\treturn (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;\n-}\n-\n /* Parse the argument given in the command line of the application */\n static int\n eal_parse_args(int argc, char **argv)\n@@ -374,45 +211,6 @@ eal_parse_args(int argc, char **argv)\n \treturn ret;\n }\n \n-static void\n-eal_check_mem_on_local_socket(void)\n-{\n-\tconst struct rte_memseg *ms;\n-\tint i, socket_id;\n-\n-\tsocket_id = rte_lcore_to_socket_id(rte_config.master_lcore);\n-\n-\tms = rte_eal_get_physmem_layout();\n-\n-\tfor (i = 0; i < RTE_MAX_MEMSEG; i++)\n-\t\tif (ms[i].socket_id == socket_id &&\n-\t\t\t\tms[i].len > 0)\n-\t\t\treturn;\n-\n-\tRTE_LOG(WARNING, EAL, \"WARNING: Master core has no \"\n-\t\t\t\"memory on local socket!\\n\");\n-}\n-\n-static int\n-sync_func(__attribute__((unused)) void *arg)\n-{\n-\treturn 0;\n-}\n-\n-inline static void\n-rte_eal_mcfg_complete(void)\n-{\n-\t/* ALL shared mem_config related INIT DONE */\n-\tif (rte_config.process_type == RTE_PROC_PRIMARY)\n-\t\trte_config.mem_config->magic = RTE_MAGIC;\n-}\n-\n-/* return non-zero if hugepages are enabled. */\n-int rte_eal_has_hugepages(void)\n-{\n-\treturn !internal_config.no_hugetlbfs;\n-}\n-\n /* Abstraction for port I/0 privilege */\n int\n rte_eal_iopl_init(void)\n@@ -476,7 +274,7 @@ rte_eal_init(int argc, char **argv)\n \n \trte_srand(rte_rdtsc());\n \n-\trte_config_init();\n+\trte_eal_config_init();\n \n \tif (rte_eal_memory_init() < 0)\n \t\trte_panic(\"Cannot init memory\\n\");\n@@ -548,16 +346,3 @@ rte_eal_init(int argc, char **argv)\n \treturn fctret;\n }\n \n-/* get core role */\n-enum rte_lcore_role_t\n-rte_eal_lcore_role(unsigned lcore_id)\n-{\n-\treturn (rte_config.lcore_role[lcore_id]);\n-}\n-\n-enum rte_proc_type_t\n-rte_eal_process_type(void)\n-{\n-\treturn (rte_config.process_type);\n-}\n-\ndiff --git a/lib/librte_eal/common/eal_common.c b/lib/librte_eal/common/eal_common.c\nnew file mode 100644\nindex 0000000..a6b64b3\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_common.c\n@@ -0,0 +1,326 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2014 6WIND S.A.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <stdint.h>\n+#include <string.h>\n+#include <stdarg.h>\n+#include <unistd.h>\n+#include <pthread.h>\n+#include <syslog.h>\n+#include <getopt.h>\n+#include <sys/file.h>\n+#include <stddef.h>\n+#include <errno.h>\n+#include <limits.h>\n+#include <errno.h>\n+#include <sys/mman.h>\n+#include <sys/queue.h>\n+\n+#include <rte_common.h>\n+#include <rte_debug.h>\n+#include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_launch.h>\n+#include <rte_tailq.h>\n+#include <rte_eal.h>\n+#include <rte_eal_memconfig.h>\n+#include <rte_per_lcore.h>\n+#include <rte_lcore.h>\n+#include <rte_log.h>\n+#include <rte_random.h>\n+#include <rte_cycles.h>\n+#include <rte_string_fns.h>\n+#include <rte_cpuflags.h>\n+#include <rte_interrupts.h>\n+#include <rte_pci.h>\n+#include <rte_dev.h>\n+#include <rte_devargs.h>\n+#include <rte_common.h>\n+#include <rte_version.h>\n+#include <rte_atomic.h>\n+#include <malloc_heap.h>\n+#include <rte_eth_ring.h>\n+\n+#include \"eal_private.h\"\n+#include \"eal_thread.h\"\n+#include \"eal_internal_cfg.h\"\n+#include \"eal_filesystem.h\"\n+#include \"eal_hugepages.h\"\n+#include \"eal_options.h\"\n+\n+/* Allow the application to print its usage message too if set */\n+rte_usage_hook_t rte_application_usage_hook = NULL;\n+\n+/* define fd variable here, because file needs to be kept open for the\n+ * duration of the program, as we hold a write lock on it in the primary proc */\n+int mem_cfg_fd = -1;\n+\n+/* early configuration structure, when memory config is not mmapped */\n+static struct rte_mem_config early_mem_config;\n+\n+/* Address of global and public configuration */\n+struct rte_config rte_config = {\n+\t\t.mem_config = &early_mem_config,\n+};\n+\n+static struct flock wr_lock = {\n+\t\t.l_type = F_WRLCK,\n+\t\t.l_whence = SEEK_SET,\n+\t\t.l_start = offsetof(struct rte_mem_config, memseg),\n+\t\t.l_len = sizeof(early_mem_config.memseg),\n+};\n+\n+/* Return a pointer to the configuration structure */\n+struct rte_config *\n+rte_eal_get_configuration(void)\n+{\n+\treturn &rte_config;\n+}\n+\n+/* parse a sysfs (or other) file containing one integer value */\n+int\n+eal_parse_sysfs_value(const char *filename, unsigned long *val)\n+{\n+\tFILE *f;\n+\tchar buf[BUFSIZ];\n+\tchar *end = NULL;\n+\n+\tf = fopen(filename, \"r\");\n+\tif (f == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open sysfs value %s\\n\",\n+\t\t\t__func__, filename);\n+\t\treturn -1;\n+\t}\n+\n+\tif (fgets(buf, sizeof(buf), f) == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot read sysfs value %s\\n\",\n+\t\t\t__func__, filename);\n+\t\tfclose(f);\n+\t\treturn -1;\n+\t}\n+\t*val = strtoul(buf, &end, 0);\n+\tif ((buf[0] == '\\0') || (end == NULL) || (*end != '\\n')) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot parse sysfs value %s\\n\",\n+\t\t\t\t__func__, filename);\n+\t\tfclose(f);\n+\t\treturn -1;\n+\t}\n+\tfclose(f);\n+\treturn 0;\n+}\n+\n+\n+/* create memory configuration in shared/mmap memory. Take out\n+ * a write lock on the memsegs, so we can auto-detect primary/secondary.\n+ * This means we never close the file while running (auto-close on exit).\n+ * We also don't lock the whole file, so that in future we can use read-locks\n+ * on other parts, e.g. memzones, to detect if there are running secondary\n+ * processes. */\n+static void\n+rte_eal_config_create(void)\n+{\n+\tvoid *rte_mem_cfg_addr;\n+\tint retval;\n+\n+\tconst char *pathname = eal_runtime_config_path();\n+\n+\tif (internal_config.no_shconf)\n+\t\treturn;\n+\n+\trte_mem_cfg_addr = rte_eal_get_mem_cfg_addr();\n+\n+\tif (mem_cfg_fd < 0) {\n+\t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);\n+\t\tif (mem_cfg_fd < 0)\n+\t\t\trte_panic(\"Cannot open '%s' for rte_mem_config\\n\",\n+\t\t\t\t\tpathname);\n+\t}\n+\n+\tretval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));\n+\tif (retval < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\trte_panic(\"Cannot resize '%s' for rte_mem_config\\n\", pathname);\n+\t}\n+\n+\tretval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);\n+\tif (retval < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\trte_exit(EXIT_FAILURE, \"Cannot create lock on '%s'. \"\n+\t\t\t\"Is another primary process running?\\n\", pathname);\n+\t}\n+\n+\trte_mem_cfg_addr = mmap(rte_mem_cfg_addr,\n+\t\t\tsizeof(*rte_config.mem_config), PROT_READ | PROT_WRITE,\n+\t\t\tMAP_SHARED, mem_cfg_fd, 0);\n+\n+\tif (rte_mem_cfg_addr == MAP_FAILED)\n+\t\trte_panic(\"Cannot mmap memory for rte_config\\n\");\n+\n+\tmemcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));\n+\trte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;\n+\n+\t/* store address of the config in the config itself so that secondary\n+\t * processes could later map the config into this exact location\n+\t */\n+\trte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;\n+}\n+\n+/* Detect if we are a primary or a secondary process */\n+enum rte_proc_type_t\n+eal_proc_type_detect(void)\n+{\n+\tenum rte_proc_type_t ptype = RTE_PROC_PRIMARY;\n+\tconst char *pathname = eal_runtime_config_path();\n+\n+\t/* if we can open the file but not get a write-lock we are\n+\t * a secondary process. NOTE: if we get a file handle back,\n+\t * we keep that open and don't close it to prevent a race\n+\t * condition between multiple opens\n+\t */\n+\tmem_cfg_fd = open(pathname, O_RDWR);\n+\tif ((mem_cfg_fd >= 0) &&\n+\t\t\t(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))\n+\t\tptype = RTE_PROC_SECONDARY;\n+\n+\tRTE_LOG(INFO, EAL, \"Auto-detected process type: %s\\n\",\n+\t\t\tptype == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n+\n+\treturn ptype;\n+}\n+\n+/* Sets up rte_config structure with the pointer to shared memory config.*/\n+void\n+rte_eal_config_init(void)\n+{\n+\trte_config.process_type = internal_config.process_type;\n+\n+\tswitch (rte_config.process_type) {\n+\tcase RTE_PROC_PRIMARY:\n+\t\trte_eal_config_create();\n+\t\tbreak;\n+\tcase RTE_PROC_SECONDARY:\n+\t\trte_eal_config_attach();\n+\t\trte_eal_mcfg_wait_complete(rte_config.mem_config);\n+\t\trte_eal_config_reattach();\n+\t\tbreak;\n+\tcase RTE_PROC_AUTO:\n+\tcase RTE_PROC_INVALID:\n+\t\trte_panic(\"Invalid process type\\n\");\n+\t}\n+}\n+\n+/* Set a per-application usage message */\n+rte_usage_hook_t\n+rte_set_application_usage_hook(rte_usage_hook_t usage_func)\n+{\n+\trte_usage_hook_t\told_func;\n+\n+\t/* Will be NULL on the first call to denote the last usage routine. */\n+\told_func\t= rte_application_usage_hook;\n+\trte_application_usage_hook\t= usage_func;\n+\n+\treturn old_func;\n+}\n+\n+inline size_t\n+eal_get_hugepage_mem_size(void)\n+{\n+\tuint64_t size = 0;\n+\tunsigned i, j;\n+\n+\tfor (i = 0; i < internal_config.num_hugepage_sizes; i++) {\n+\t\tstruct hugepage_info *hpi = &internal_config.hugepage_info[i];\n+\n+\t\tif (hpi->hugedir != NULL) {\n+\t\t\tfor (j = 0; j < RTE_MAX_NUMA_NODES; j++)\n+\t\t\t\tsize += hpi->hugepage_sz * hpi->num_pages[j];\n+\t\t}\n+\t}\n+\n+\treturn (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;\n+}\n+\n+void\n+eal_check_mem_on_local_socket(void)\n+{\n+\tconst struct rte_memseg *ms;\n+\tint i, socket_id;\n+\n+\tsocket_id = rte_lcore_to_socket_id(rte_config.master_lcore);\n+\n+\tms = rte_eal_get_physmem_layout();\n+\n+\tfor (i = 0; i < RTE_MAX_MEMSEG; i++)\n+\t\tif (ms[i].socket_id == socket_id &&\n+\t\t\t\tms[i].len > 0)\n+\t\t\treturn;\n+\n+\tRTE_LOG(WARNING, EAL, \"WARNING: Master core has no \"\n+\t\t\t\"memory on local socket!\\n\");\n+}\n+\n+int\n+sync_func(__attribute__((unused)) void *arg)\n+{\n+\treturn 0;\n+}\n+\n+inline void\n+rte_eal_mcfg_complete(void)\n+{\n+\t/* ALL shared mem_config related INIT DONE */\n+\tif (rte_config.process_type == RTE_PROC_PRIMARY)\n+\t\trte_config.mem_config->magic = RTE_MAGIC;\n+}\n+\n+/* return non-zero if hugepages are enabled. */\n+int rte_eal_has_hugepages(void)\n+{\n+\treturn !internal_config.no_hugetlbfs;\n+}\n+\n+/* get core role */\n+enum rte_lcore_role_t\n+rte_eal_lcore_role(unsigned lcore_id)\n+{\n+\treturn rte_config.lcore_role[lcore_id];\n+}\n+\n+enum rte_proc_type_t\n+rte_eal_process_type(void)\n+{\n+\treturn rte_config.process_type;\n+}\ndiff --git a/lib/librte_eal/common/eal_externs.h b/lib/librte_eal/common/eal_externs.h\nnew file mode 100644\nindex 0000000..b19bea6\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_externs.h\n@@ -0,0 +1,42 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef EAL_EXTERNS_H\n+#define EAL_EXTERNS_H\n+\n+/* Extern declarations defined in eal_common.c */\n+extern struct rte_config rte_config;\n+extern int mem_cfg_fd;\n+extern rte_usage_hook_t\trte_application_usage_hook;\n+\n+#endif\ndiff --git a/lib/librte_eal/common/eal_hugepages.h b/lib/librte_eal/common/eal_hugepages.h\nindex 38edac0..0b4d7a2 100644\n--- a/lib/librte_eal/common/eal_hugepages.h\n+++ b/lib/librte_eal/common/eal_hugepages.h\n@@ -63,5 +63,6 @@ struct hugepage_file {\n  * for the EAL to use\n  */\n int eal_hugepage_info_init(void);\n+inline size_t eal_get_hugepage_mem_size(void);\n \n #endif /* EAL_HUGEPAGES_H */\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 232fcec..b1d68bc 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -203,4 +203,51 @@ int rte_eal_alarm_init(void);\n  */\n int rte_eal_dev_init(void);\n \n+/**\n+ * This function sets up rte_config structure\n+ *\n+ * This function is private to the EAL.\n+ */\n+void rte_eal_config_init(void);\n+\n+/**\n+ * This function checks memory on local socket(NUMA)\n+ *\n+ * This function is private to the EAL.\n+ */\n+void eal_check_mem_on_local_socket(void);\n+\n+/**\n+ * This function updates shared mem_config INIT DONE\n+ *\n+ * This function is private to the EAL.\n+ */\n+inline void rte_eal_mcfg_complete(void);\n+\n+/**\n+ *\n+ * This function is private to the EAL.\n+ */\n+int sync_func(__attribute__((unused)) void *arg);\n+\n+/**\n+ *\n+ * This function is private to the EAL.\n+ */\n+inline void *rte_eal_get_mem_cfg_addr(void);\n+\n+/**\n+ * This function attaches shared memory config\n+ *\n+ * This function is private to the EAL.\n+ */\n+void rte_eal_config_attach(void);\n+\n+/**\n+ * This function reattaches shared memory config\n+ *\n+ * This function is private to the EAL.\n+ */\n+void rte_eal_config_reattach(void);\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 9252333..60cc448 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -70,6 +70,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_ivshmem.c\n endif\n \n # from common dir\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_memzone.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_log.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_launch.c\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 2fb1acc..6d3f854 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -84,14 +84,12 @@\n #include \"eal_filesystem.h\"\n #include \"eal_hugepages.h\"\n #include \"eal_options.h\"\n+#include \"eal_externs.h\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n \n #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)\n \n-/* Allow the application to print its usage message too if set */\n-static rte_usage_hook_t\trte_application_usage_hook = NULL;\n-\n TAILQ_HEAD(shared_driver_list, shared_driver);\n \n /* Definition for shared object drivers. */\n@@ -106,25 +104,6 @@ struct shared_driver {\n static struct shared_driver_list solib_list =\n TAILQ_HEAD_INITIALIZER(solib_list);\n \n-/* early configuration structure, when memory config is not mmapped */\n-static struct rte_mem_config early_mem_config;\n-\n-/* define fd variable here, because file needs to be kept open for the\n- * duration of the program, as we hold a write lock on it in the primary proc */\n-static int mem_cfg_fd = -1;\n-\n-static struct flock wr_lock = {\n-\t\t.l_type = F_WRLCK,\n-\t\t.l_whence = SEEK_SET,\n-\t\t.l_start = offsetof(struct rte_mem_config, memseg),\n-\t\t.l_len = sizeof(early_mem_config.memseg),\n-};\n-\n-/* Address of global and public configuration */\n-static struct rte_config rte_config = {\n-\t\t.mem_config = &early_mem_config,\n-};\n-\n /* internal configuration (per-core) */\n struct lcore_config lcore_config[RTE_MAX_LCORE];\n \n@@ -134,106 +113,23 @@ struct internal_config internal_config;\n /* used by rte_rdtsc() */\n int rte_cycles_vmware_tsc_map;\n \n-/* Return a pointer to the configuration structure */\n-struct rte_config *\n-rte_eal_get_configuration(void)\n-{\n-\treturn &rte_config;\n-}\n-\n-/* parse a sysfs (or other) file containing one integer value */\n-int\n-eal_parse_sysfs_value(const char *filename, unsigned long *val)\n-{\n-\tFILE *f;\n-\tchar buf[BUFSIZ];\n-\tchar *end = NULL;\n-\n-\tif ((f = fopen(filename, \"r\")) == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open sysfs value %s\\n\",\n-\t\t\t__func__, filename);\n-\t\treturn -1;\n-\t}\n-\n-\tif (fgets(buf, sizeof(buf), f) == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot read sysfs value %s\\n\",\n-\t\t\t__func__, filename);\n-\t\tfclose(f);\n-\t\treturn -1;\n-\t}\n-\t*val = strtoul(buf, &end, 0);\n-\tif ((buf[0] == '\\0') || (end == NULL) || (*end != '\\n')) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot parse sysfs value %s\\n\",\n-\t\t\t\t__func__, filename);\n-\t\tfclose(f);\n-\t\treturn -1;\n-\t}\n-\tfclose(f);\n-\treturn 0;\n-}\n-\n-\n-/* create memory configuration in shared/mmap memory. Take out\n- * a write lock on the memsegs, so we can auto-detect primary/secondary.\n- * This means we never close the file while running (auto-close on exit).\n- * We also don't lock the whole file, so that in future we can use read-locks\n- * on other parts, e.g. memzones, to detect if there are running secondary\n- * processes. */\n-static void\n-rte_eal_config_create(void)\n+inline void *\n+rte_eal_get_mem_cfg_addr(void)\n {\n-\tvoid *rte_mem_cfg_addr;\n-\tint retval;\n-\n-\tconst char *pathname = eal_runtime_config_path();\n-\n-\tif (internal_config.no_shconf)\n-\t\treturn;\n+\tvoid *mem_cfg_addr;\n \n-\t/* map the config before hugepage address so that we don't waste a page */\n \tif (internal_config.base_virtaddr != 0)\n-\t\trte_mem_cfg_addr = (void *)\n+\t\tmem_cfg_addr = (void *)\n \t\t\tRTE_ALIGN_FLOOR(internal_config.base_virtaddr -\n \t\t\tsizeof(struct rte_mem_config), sysconf(_SC_PAGE_SIZE));\n \telse\n-\t\trte_mem_cfg_addr = NULL;\n-\n-\tif (mem_cfg_fd < 0){\n-\t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);\n-\t\tif (mem_cfg_fd < 0)\n-\t\t\trte_panic(\"Cannot open '%s' for rte_mem_config\\n\", pathname);\n-\t}\n-\n-\tretval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));\n-\tif (retval < 0){\n-\t\tclose(mem_cfg_fd);\n-\t\trte_panic(\"Cannot resize '%s' for rte_mem_config\\n\", pathname);\n-\t}\n-\n-\tretval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);\n-\tif (retval < 0){\n-\t\tclose(mem_cfg_fd);\n-\t\trte_exit(EXIT_FAILURE, \"Cannot create lock on '%s'. Is another primary \"\n-\t\t\t\t\"process running?\\n\", pathname);\n-\t}\n-\n-\trte_mem_cfg_addr = mmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config),\n-\t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n-\n-\tif (rte_mem_cfg_addr == MAP_FAILED){\n-\t\trte_panic(\"Cannot mmap memory for rte_config\\n\");\n-\t}\n-\tmemcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));\n-\trte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;\n-\n-\t/* store address of the config in the config itself so that secondary\n-\t * processes could later map the config into this exact location */\n-\trte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;\n+\t\tmem_cfg_addr = NULL;\n \n+\treturn mem_cfg_addr;\n }\n \n /* attach to an existing shared memory config */\n-static void\n+void\n rte_eal_config_attach(void)\n {\n \tstruct rte_mem_config *mem_config;\n@@ -259,7 +155,7 @@ rte_eal_config_attach(void)\n }\n \n /* reattach the shared config at exact memory location primary process has it */\n-static void\n+void\n rte_eal_config_reattach(void)\n {\n \tstruct rte_mem_config *mem_config;\n@@ -285,47 +181,6 @@ rte_eal_config_reattach(void)\n \trte_config.mem_config = mem_config;\n }\n \n-/* Detect if we are a primary or a secondary process */\n-enum rte_proc_type_t\n-eal_proc_type_detect(void)\n-{\n-\tenum rte_proc_type_t ptype = RTE_PROC_PRIMARY;\n-\tconst char *pathname = eal_runtime_config_path();\n-\n-\t/* if we can open the file but not get a write-lock we are a secondary\n-\t * process. NOTE: if we get a file handle back, we keep that open\n-\t * and don't close it to prevent a race condition between multiple opens */\n-\tif (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&\n-\t\t\t(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))\n-\t\tptype = RTE_PROC_SECONDARY;\n-\n-\tRTE_LOG(INFO, EAL, \"Auto-detected process type: %s\\n\",\n-\t\t\tptype == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n-\n-\treturn ptype;\n-}\n-\n-/* Sets up rte_config structure with the pointer to shared memory config.*/\n-static void\n-rte_config_init(void)\n-{\n-\trte_config.process_type = internal_config.process_type;\n-\n-\tswitch (rte_config.process_type){\n-\tcase RTE_PROC_PRIMARY:\n-\t\trte_eal_config_create();\n-\t\tbreak;\n-\tcase RTE_PROC_SECONDARY:\n-\t\trte_eal_config_attach();\n-\t\trte_eal_mcfg_wait_complete(rte_config.mem_config);\n-\t\trte_eal_config_reattach();\n-\t\tbreak;\n-\tcase RTE_PROC_AUTO:\n-\tcase RTE_PROC_INVALID:\n-\t\trte_panic(\"Invalid process type\\n\");\n-\t}\n-}\n-\n /* Unlocks hugepage directories that were locked by eal_hugepage_info_init */\n static void\n eal_hugedirs_unlock(void)\n@@ -371,19 +226,6 @@ eal_usage(const char *prgname)\n \t}\n }\n \n-/* Set a per-application usage message */\n-rte_usage_hook_t\n-rte_set_application_usage_hook( rte_usage_hook_t usage_func )\n-{\n-\trte_usage_hook_t\told_func;\n-\n-\t/* Will be NULL on the first call to denote the last usage routine. */\n-\told_func\t\t\t\t\t= rte_application_usage_hook;\n-\trte_application_usage_hook\t= usage_func;\n-\n-\treturn old_func;\n-}\n-\n static int\n eal_parse_socket_mem(char *socket_mem)\n {\n@@ -485,24 +327,6 @@ eal_parse_vfio_intr(const char *mode)\n \treturn -1;\n }\n \n-static inline size_t\n-eal_get_hugepage_mem_size(void)\n-{\n-\tuint64_t size = 0;\n-\tunsigned i, j;\n-\n-\tfor (i = 0; i < internal_config.num_hugepage_sizes; i++) {\n-\t\tstruct hugepage_info *hpi = &internal_config.hugepage_info[i];\n-\t\tif (hpi->hugedir != NULL) {\n-\t\t\tfor (j = 0; j < RTE_MAX_NUMA_NODES; j++) {\n-\t\t\t\tsize += hpi->hugepage_sz * hpi->num_pages[j];\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\treturn (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;\n-}\n-\n /* Parse the argument given in the command line of the application */\n static int\n eal_parse_args(int argc, char **argv)\n@@ -643,39 +467,6 @@ eal_parse_args(int argc, char **argv)\n \treturn ret;\n }\n \n-static void\n-eal_check_mem_on_local_socket(void)\n-{\n-\tconst struct rte_memseg *ms;\n-\tint i, socket_id;\n-\n-\tsocket_id = rte_lcore_to_socket_id(rte_config.master_lcore);\n-\n-\tms = rte_eal_get_physmem_layout();\n-\n-\tfor (i = 0; i < RTE_MAX_MEMSEG; i++)\n-\t\tif (ms[i].socket_id == socket_id &&\n-\t\t\t\tms[i].len > 0)\n-\t\t\treturn;\n-\n-\tRTE_LOG(WARNING, EAL, \"WARNING: Master core has no \"\n-\t\t\t\"memory on local socket!\\n\");\n-}\n-\n-static int\n-sync_func(__attribute__((unused)) void *arg)\n-{\n-\treturn 0;\n-}\n-\n-inline static void\n-rte_eal_mcfg_complete(void)\n-{\n-\t/* ALL shared mem_config related INIT DONE */\n-\tif (rte_config.process_type == RTE_PROC_PRIMARY)\n-\t\trte_config.mem_config->magic = RTE_MAGIC;\n-}\n-\n /*\n  * Request iopl privilege for all RPL, returns 0 on success\n  * iopl() call is mostly for the i386 architecture. For other architectures,\n@@ -750,7 +541,7 @@ rte_eal_init(int argc, char **argv)\n \n \trte_srand(rte_rdtsc());\n \n-\trte_config_init();\n+\trte_eal_config_init();\n \n \tif (rte_eal_pci_init() < 0)\n \t\trte_panic(\"Cannot init PCI\\n\");\n@@ -842,20 +633,3 @@ rte_eal_init(int argc, char **argv)\n \treturn fctret;\n }\n \n-/* get core role */\n-enum rte_lcore_role_t\n-rte_eal_lcore_role(unsigned lcore_id)\n-{\n-\treturn (rte_config.lcore_role[lcore_id]);\n-}\n-\n-enum rte_proc_type_t\n-rte_eal_process_type(void)\n-{\n-\treturn (rte_config.process_type);\n-}\n-\n-int rte_eal_has_hugepages(void)\n-{\n-\treturn ! internal_config.no_hugetlbfs;\n-}\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "3/6"
    ]
}