get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2171,
    "url": "https://patches.dpdk.org/api/patches/2171/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1419694402-2215-4-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": "<1419694402-2215-4-git-send-email-rkerur@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1419694402-2215-4-git-send-email-rkerur@gmail.com",
    "date": "2014-12-27T15:33:20",
    "name": "[dpdk-dev,v2,4/6] Move EAL common functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "290083272c8ee9c3e1fa3417069d34bdefd54995",
    "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/1419694402-2215-4-git-send-email-rkerur@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2171/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2171/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 17C9E569B;\n\tSat, 27 Dec 2014 16:33:42 +0100 (CET)",
            "from mail-pa0-f54.google.com (mail-pa0-f54.google.com\n\t[209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 6B695568C\n\tfor <dev@dpdk.org>; Sat, 27 Dec 2014 16:33:35 +0100 (CET)",
            "by mail-pa0-f54.google.com with SMTP id fb1so14716206pad.27\n\tfor <dev@dpdk.org>; Sat, 27 Dec 2014 07:33:34 -0800 (PST)",
            "from iaas-l305162.englab.brocade.com ([144.49.130.148])\n\tby mx.google.com with ESMTPSA id\n\tzk9sm31325490pac.1.2014.12.27.07.33.33\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 27 Dec 2014 07:33:34 -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=6YZb/75dGNw32HJaOSFvWpjoG6GPCSgggcf5qxrwEio=;\n\tb=AaQ2ZjcA+rBSonRQ+UytXGzwLHElxhmC6vX5FV7YcIdQTv4VFOj7mWaSi1eeTjB4E4\n\tGk+TCBoxKri8yF+UZVMSqg5nRYxAmLU/eLKMns7O0f3YcCW3v7YYSYyMZwS5+cDNeIWt\n\tWv323eoRkvi/9yYfIvr7y2qr8KW/uPIUS5fbA4f0R5tEMLPKuzf+Qyg9XGSVrg8iIT7s\n\tUHTBlz8jV6G/8XHYlmh8OQWQUFyKo2wxpDSVVSMDe2Wi9igtOO20sVWqwP8JAdudKnzF\n\tlI+HOhuS7Xs5ft1R8fOf73ut2zatBOr35EUMfQ1AnRVEoO/b6z+YfseshRa5gX7f+Axl\n\tN3ZQ==",
        "X-Received": "by 10.66.155.225 with SMTP id vz1mr74609410pab.133.1419694414706;\n\tSat, 27 Dec 2014 07:33:34 -0800 (PST)",
        "From": "Ravi Kerur <rkerur@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Sat, 27 Dec 2014 10:33:20 -0500",
        "Message-Id": "<1419694402-2215-4-git-send-email-rkerur@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1419694402-2215-1-git-send-email-rkerur@gmail.com>",
        "References": "<1419694322-2114-1-git-send-email-rkerur@gmail.com>\n\t<1419694402-2215-1-git-send-email-rkerur@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH v2 4/6] Move EAL common functions",
        "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 v2\nNone\n\nMove common functions in eal_lcore.c to librte_eal/common\ndirectory.\nUse RTE_EXEC_ENV_BSDAPP to differentiate minor differences in\ncommon functions.\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_lcore.c    |  62 ++++--------------\n lib/librte_eal/common/eal_common_lcore.c | 106 +++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_private.h      |  32 ++++++++++\n lib/librte_eal/linuxapp/eal/Makefile     |   1 +\n lib/librte_eal/linuxapp/eal/eal_lcore.c  |  55 +---------------\n 6 files changed, 155 insertions(+), 102 deletions(-)\n create mode 100644 lib/librte_eal/common/eal_common_lcore.c",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 050d70b..560b7a3 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -74,6 +74,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c\n \n CFLAGS_eal.o := -D_GNU_SOURCE\n #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE\ndiff --git a/lib/librte_eal/bsdapp/eal/eal_lcore.c b/lib/librte_eal/bsdapp/eal/eal_lcore.c\nindex 662f024..874fd88 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_lcore.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_lcore.c\n@@ -43,10 +43,19 @@\n #include \"eal_private.h\"\n \n /* No topology information available on FreeBSD including NUMA info */\n-#define cpu_core_id(X) 0\n-#define cpu_socket_id(X) 0\n+unsigned\n+cpu_core_id(__attribute__((unused)) unsigned lcore_id)\n+{\n+\treturn 0;\n+}\n+\n+unsigned\n+cpu_socket_id(__attribute__((unused)) unsigned lcore_id)\n+{\n+\treturn 0;\n+}\n \n-static int\n+int\n get_ncpus(void)\n {\n \tint mib[2] = {CTL_HW, HW_NCPU};\n@@ -58,50 +67,3 @@ get_ncpus(void)\n \treturn ncpu;\n }\n \n-/*\n- * fill the cpu_info structure with as much info as we can get.\n- * code is similar to linux version, but sadly available info is less.\n- */\n-int\n-rte_eal_cpu_init(void)\n-{\n-\t/* pointer to global configuration */\n-\tstruct rte_config *config = rte_eal_get_configuration();\n-\tunsigned lcore_id;\n-\tunsigned count = 0;\n-\n-\tconst unsigned ncpus = get_ncpus();\n-\t/*\n-\t * Parse the maximum set of logical cores, detect the subset of running\n-\t * ones and enable them by default.\n-\t */\n-\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n-\t\tlcore_config[lcore_id].detected = (lcore_id < ncpus);\n-\t\tif (lcore_config[lcore_id].detected == 0) {\n-\t\t\tconfig->lcore_role[lcore_id] = ROLE_OFF;\n-\t\t\tcontinue;\n-\t\t}\n-\t\t/* By default, each detected core is enabled */\n-\t\tconfig->lcore_role[lcore_id] = ROLE_RTE;\n-\t\tlcore_config[lcore_id].core_id = cpu_core_id(lcore_id);\n-\t\tlcore_config[lcore_id].socket_id = cpu_socket_id(lcore_id);\n-\t\tif (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES)\n-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID\n-\t\t\tlcore_config[lcore_id].socket_id = 0;\n-#else\n-\t\t\trte_panic(\"Socket ID (%u) is greater than \"\n-\t\t\t\t\"RTE_MAX_NUMA_NODES (%d)\\n\",\n-\t\t\t\tlcore_config[lcore_id].socket_id, RTE_MAX_NUMA_NODES);\n-#endif\n-\t\tRTE_LOG(DEBUG, EAL, \"Detected lcore %u\\n\",\n-\t\t\t\tlcore_id);\n-\t\tcount++;\n-\t}\n-\t/* Set the count of enabled logical cores of the EAL configuration */\n-\tconfig->lcore_count = count;\n-\tRTE_LOG(DEBUG, EAL, \"Support maximum %u logical core(s) by configuration.\\n\",\n-\t\tRTE_MAX_LCORE);\n-\tRTE_LOG(DEBUG, EAL, \"Detected %u lcore(s)\\n\", config->lcore_count);\n-\n-\treturn 0;\n-}\ndiff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c\nnew file mode 100644\nindex 0000000..af19d00\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_common_lcore.c\n@@ -0,0 +1,106 @@\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+#include <unistd.h>\n+#include <sys/sysctl.h>\n+\n+#include <rte_log.h>\n+#include <rte_eal.h>\n+#include <rte_lcore.h>\n+#include <rte_common.h>\n+#include <rte_debug.h>\n+\n+#include \"eal_private.h\"\n+\n+/*\n+ * fill the cpu_info structure with as much info as we can get.\n+ * code is similar to linux version, but sadly available info is less.\n+ */\n+int\n+rte_eal_cpu_init(void)\n+{\n+\t/* pointer to global configuration */\n+\tstruct rte_config *config = rte_eal_get_configuration();\n+\tunsigned lcore_id;\n+\tunsigned count = 0;\n+\n+\t/*\n+\t * Parse the maximum set of logical cores, detect the subset of running\n+\t * ones and enable them by default.\n+\t */\n+\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+\t\tconst unsigned ncpus = get_ncpus();\n+\n+\t\tlcore_config[lcore_id].detected = (lcore_id < ncpus);\n+#else /* RTE_EXEC_ENV_BSDAPP */\n+\t\tlcore_config[lcore_id].detected = cpu_detected(lcore_id);\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\t\tif (lcore_config[lcore_id].detected == 0) {\n+\t\t\tconfig->lcore_role[lcore_id] = ROLE_OFF;\n+\t\t\tcontinue;\n+\t\t}\n+\t\t/* By default, each detected core is enabled */\n+\t\tconfig->lcore_role[lcore_id] = ROLE_RTE;\n+\t\tlcore_config[lcore_id].core_id = cpu_core_id(lcore_id);\n+\t\tlcore_config[lcore_id].socket_id = cpu_socket_id(lcore_id);\n+\t\tif (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES)\n+#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID\n+\t\t\tlcore_config[lcore_id].socket_id = 0;\n+#else\n+\t\t\trte_panic(\"Socket ID (%u) is greater than \"\n+\t\t\t\t\"RTE_MAX_NUMA_NODES (%d)\\n\",\n+\t\t\t\tlcore_config[lcore_id].socket_id,\n+\t\t\t\tRTE_MAX_NUMA_NODES);\n+#endif\n+\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+\t\tRTE_LOG(DEBUG, EAL, \"Detected lcore %u\\n\",\n+\t\t\t\tlcore_id);\n+#else /* RTE_EXEC_ENV_BSDAPP */\n+\t\tRTE_LOG(DEBUG, EAL, \"Detected lcore %u as \"\n+\t\t\t\t\"core %u on socket %u\\n\",\n+\t\t\t\tlcore_id, lcore_config[lcore_id].core_id,\n+\t\t\t\tlcore_config[lcore_id].socket_id);\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\t\tcount++;\n+\t}\n+\t/* Set the count of enabled logical cores of the EAL configuration */\n+\tconfig->lcore_count = count;\n+\tRTE_LOG(DEBUG, EAL,\n+\t\t\"Support maximum %u logical core(s) by configuration.\\n\",\n+\t\tRTE_MAX_LCORE);\n+\tRTE_LOG(DEBUG, EAL, \"Detected %u lcore(s)\\n\", config->lcore_count);\n+\n+\treturn 0;\n+}\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex b1d68bc..9fe91b3 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -250,4 +250,36 @@ void rte_eal_config_attach(void);\n  */\n void rte_eal_config_reattach(void);\n \n+/**\n+ * This function gets cpu socket_id\n+ *\n+ * This function is private to the EAL.\n+ */\n+unsigned cpu_socket_id(unsigned lcore_id);\n+\n+/**\n+ * This function gets cpu core_id\n+ *\n+ * This function is private to the EAL.\n+ */\n+unsigned cpu_core_id(unsigned lcore_id);\n+\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+/**\n+ * This function gets no. of cpus\n+ *\n+ * This function is private to the EAL.\n+ */\n+int get_ncpus(void);\n+\n+#else /* RTE_EXEC_ENV_BSDAPP */\n+/**\n+ * This function check if cpu is present\n+ *\n+ * This function is private to the EAL.\n+ */\n+int cpu_detected(unsigned lcore_id);\n+\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 60cc448..ff185fd 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -86,6 +86,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_lcore.c\n \n CFLAGS_eal.o := -D_GNU_SOURCE\n CFLAGS_eal_common_thread.o := -D_GNU_SOURCE\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_lcore.c b/lib/librte_eal/linuxapp/eal/eal_lcore.c\nindex c67e0e6..4fe2a53 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_lcore.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_lcore.c\n@@ -51,7 +51,7 @@\n #define PHYS_PKG_FILE \"topology/physical_package_id\"\n \n /* Check if a cpu is present by the presence of the cpu information for it */\n-static int\n+int\n cpu_detected(unsigned lcore_id)\n {\n \tchar path[PATH_MAX];\n@@ -71,7 +71,7 @@ cpu_detected(unsigned lcore_id)\n  * Note: physical package id != NUMA node, but we use it as a\n  * fallback for kernels which don't create a nodeY link\n  */\n-static unsigned\n+unsigned\n cpu_socket_id(unsigned lcore_id)\n {\n \tconst char node_prefix[] = \"node\";\n@@ -121,7 +121,7 @@ err:\n }\n \n /* Get the cpu core id value from the /sys/.../cpuX core_id value */\n-static unsigned\n+unsigned\n cpu_core_id(unsigned lcore_id)\n {\n \tchar path[PATH_MAX];\n@@ -140,52 +140,3 @@ err:\n \treturn 0;\n }\n \n-/*\n- * Parse /sys/devices/system/cpu to get the number of physical and logical\n- * processors on the machine. The function will fill the cpu_info\n- * structure.\n- */\n-int\n-rte_eal_cpu_init(void)\n-{\n-\t/* pointer to global configuration */\n-\tstruct rte_config *config = rte_eal_get_configuration();\n-\tunsigned lcore_id;\n-\tunsigned count = 0;\n-\n-\t/*\n-\t * Parse the maximum set of logical cores, detect the subset of running\n-\t * ones and enable them by default.\n-\t */\n-\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n-\t\tlcore_config[lcore_id].detected = cpu_detected(lcore_id);\n-\t\tif (lcore_config[lcore_id].detected == 0) {\n-\t\t\tconfig->lcore_role[lcore_id] = ROLE_OFF;\n-\t\t\tcontinue;\n-\t\t}\n-\t\t/* By default, each detected core is enabled */\n-\t\tconfig->lcore_role[lcore_id] = ROLE_RTE;\n-\t\tlcore_config[lcore_id].core_id = cpu_core_id(lcore_id);\n-\t\tlcore_config[lcore_id].socket_id = cpu_socket_id(lcore_id);\n-\t\tif (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES)\n-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID\n-\t\t\tlcore_config[lcore_id].socket_id = 0;\n-#else\n-\t\t\trte_panic(\"Socket ID (%u) is greater than \"\n-\t\t\t\t\"RTE_MAX_NUMA_NODES (%d)\\n\",\n-\t\t\t\tlcore_config[lcore_id].socket_id, RTE_MAX_NUMA_NODES);\n-#endif\n-\t\tRTE_LOG(DEBUG, EAL, \"Detected lcore %u as core %u on socket %u\\n\",\n-\t\t\t\tlcore_id,\n-\t\t\t\tlcore_config[lcore_id].core_id,\n-\t\t\t\tlcore_config[lcore_id].socket_id);\n-\t\tcount ++;\n-\t}\n-\t/* Set the count of enabled logical cores of the EAL configuration */\n-\tconfig->lcore_count = count;\n-\tRTE_LOG(DEBUG, EAL, \"Support maximum %u logical core(s) by configuration.\\n\",\n-\t\tRTE_MAX_LCORE);\n-\tRTE_LOG(DEBUG, EAL, \"Detected %u lcore(s)\\n\", config->lcore_count);\n-\n-\treturn 0;\n-}\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "4/6"
    ]
}