get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2204,
    "url": "https://patches.dpdk.org/api/patches/2204/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1420565213-17429-2-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": "<1420565213-17429-2-git-send-email-rkerur@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1420565213-17429-2-git-send-email-rkerur@gmail.com",
    "date": "2015-01-06T17:26:48",
    "name": "[dpdk-dev,v4,2/7] Move common functions in eal_thread.c",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e5223adb17f968c08c9b0636f6a7a1e6e0bc921f",
    "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/1420565213-17429-2-git-send-email-rkerur@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2204/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2204/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 0A27D5A62;\n\tTue,  6 Jan 2015 18:27:20 +0100 (CET)",
            "from mail-pa0-f44.google.com (mail-pa0-f44.google.com\n\t[209.85.220.44]) by dpdk.org (Postfix) with ESMTP id 6B7E4590C\n\tfor <dev@dpdk.org>; Tue,  6 Jan 2015 18:27:16 +0100 (CET)",
            "by mail-pa0-f44.google.com with SMTP id et14so31407128pad.31\n\tfor <dev@dpdk.org>; Tue, 06 Jan 2015 09:27:15 -0800 (PST)",
            "from iaas-l305162.englab.brocade.com ([144.49.130.148])\n\tby mx.google.com with ESMTPSA id\n\tnl14sm46887340pdb.81.2015.01.06.09.27.14\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 06 Jan 2015 09:27:15 -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=qatMxW3zE2+MUF/aewULLHmS4+7aQamA76wJ9908JM8=;\n\tb=iXTYNji62YSa74R+8I1se1VsoXp/O7GY0Bfy8S8LbO9zl4ddk+Ey3XOKDpvUh75H4U\n\tMZN9OKHJr+G/yI40L/MKkEXSTGTAkbulWW95L0jKxRltns5XCQOsDgqR9KCeqfiQX8w1\n\txzvOY/qKSMSmJhlljtGNuDJZxShJ8q74ddumZ2owjj6V4Xxu12hUEfwI4iTp0F8+zzDA\n\taMlAxiKImEY4egTobcilPbXcnqvsURSNFTiw6TfVbW4nmgSYXiFAaIhHS2T13HeGAw2l\n\tPhnh7DsM6Ime5VbkEqB5PugIY2pV00aIuQ0+70ScGwNvNIyluq0QSZXPF0VCpozfCWoh\n\tMT1A==",
        "X-Received": "by 10.68.201.232 with SMTP id kd8mr83069797pbc.164.1420565235633;\n\tTue, 06 Jan 2015 09:27:15 -0800 (PST)",
        "From": "Ravi Kerur <rkerur@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  6 Jan 2015 12:26:48 -0500",
        "Message-Id": "<1420565213-17429-2-git-send-email-rkerur@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1420565213-17429-1-git-send-email-rkerur@gmail.com>",
        "References": "<1420565170-17365-1-git-send-email-rkerur@gmail.com>\n\t<1420565213-17429-1-git-send-email-rkerur@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH v4 2/7] Move common functions in eal_thread.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 v4\nNone\n\nChanges in v3\nChanged subject to be more explicit on file name inclusion.\n\nChanges in v2\nNone\n\nChanges in v1\neal_thread.c has minor differences between Linux and BSD, move\nentire file into common directory.\nUse RTE_EXEC_ENV_BSDAPP to differentiate on minor differences.\nRename eal_thread.c to eal_common_thread.c\nMakefile changes to reflect file move and name change.\nFix checkpatch warnings.\n\nSigned-off-by: Ravi Kerur <rkerur@gmail.com>\n---\n lib/librte_eal/bsdapp/eal/Makefile        |   6 +-\n lib/librte_eal/bsdapp/eal/eal_thread.c    | 233 ----------------------------\n lib/librte_eal/common/eal_common_thread.c | 248 ++++++++++++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/Makefile      |   6 +-\n lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 ----------------------------\n 5 files changed, 254 insertions(+), 472 deletions(-)\n delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c\n create mode 100644 lib/librte_eal/common/eal_common_thread.c\n delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 9b83e11..92dd9a6 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -50,7 +50,6 @@ CFLAGS += $(WERROR_FLAGS) -O3\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c\n-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c\n@@ -73,16 +72,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c\n 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 \n CFLAGS_eal.o := -D_GNU_SOURCE\n-#CFLAGS_eal_thread.o := -D_GNU_SOURCE\n+#CFLAGS_eal_common_thread.o := -D_GNU_SOURCE\n CFLAGS_eal_log.o := -D_GNU_SOURCE\n CFLAGS_eal_common_log.o := -D_GNU_SOURCE\n \n # workaround for a gcc bug with noreturn attribute\n # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603\n ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)\n-CFLAGS_eal_thread.o += -Wno-return-type\n+CFLAGS_eal_common_thread.o += -Wno-return-type\n CFLAGS_eal_hpet.o += -Wno-return-type\n endif\n \ndiff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c\ndeleted file mode 100644\nindex ab05368..0000000\n--- a/lib/librte_eal/bsdapp/eal/eal_thread.c\n+++ /dev/null\n@@ -1,233 +0,0 @@\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 <errno.h>\n-#include <stdio.h>\n-#include <stdlib.h>\n-#include <stdint.h>\n-#include <unistd.h>\n-#include <sched.h>\n-#include <pthread_np.h>\n-#include <sys/queue.h>\n-\n-#include <rte_debug.h>\n-#include <rte_atomic.h>\n-#include <rte_launch.h>\n-#include <rte_log.h>\n-#include <rte_memory.h>\n-#include <rte_memzone.h>\n-#include <rte_per_lcore.h>\n-#include <rte_tailq.h>\n-#include <rte_eal.h>\n-#include <rte_per_lcore.h>\n-#include <rte_lcore.h>\n-\n-#include \"eal_private.h\"\n-#include \"eal_thread.h\"\n-\n-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);\n-\n-/*\n- * Send a message to a slave lcore identified by slave_id to call a\n- * function f with argument arg. Once the execution is done, the\n- * remote lcore switch in FINISHED state.\n- */\n-int\n-rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)\n-{\n-\tint n;\n-\tchar c = 0;\n-\tint m2s = lcore_config[slave_id].pipe_master2slave[1];\n-\tint s2m = lcore_config[slave_id].pipe_slave2master[0];\n-\n-\tif (lcore_config[slave_id].state != WAIT)\n-\t\treturn -EBUSY;\n-\n-\tlcore_config[slave_id].f = f;\n-\tlcore_config[slave_id].arg = arg;\n-\n-\t/* send message */\n-\tn = 0;\n-\twhile (n == 0 || (n < 0 && errno == EINTR))\n-\t\tn = write(m2s, &c, 1);\n-\tif (n < 0)\n-\t\trte_panic(\"cannot write on configuration pipe\\n\");\n-\n-\t/* wait ack */\n-\tdo {\n-\t\tn = read(s2m, &c, 1);\n-\t} while (n < 0 && errno == EINTR);\n-\n-\tif (n <= 0)\n-\t\trte_panic(\"cannot read on configuration pipe\\n\");\n-\n-\treturn 0;\n-}\n-\n-/* set affinity for current thread */\n-static int\n-eal_thread_set_affinity(void)\n-{\n-\tint s;\n-\tpthread_t thread;\n-\n-/*\n- * According to the section VERSIONS of the CPU_ALLOC man page:\n- *\n- * The CPU_ZERO(), CPU_SET(), CPU_CLR(), and CPU_ISSET() macros were added\n- * in glibc 2.3.3.\n- *\n- * CPU_COUNT() first appeared in glibc 2.6.\n- *\n- * CPU_AND(),     CPU_OR(),     CPU_XOR(),    CPU_EQUAL(),    CPU_ALLOC(),\n- * CPU_ALLOC_SIZE(), CPU_FREE(), CPU_ZERO_S(),  CPU_SET_S(),  CPU_CLR_S(),\n- * CPU_ISSET_S(),  CPU_AND_S(), CPU_OR_S(), CPU_XOR_S(), and CPU_EQUAL_S()\n- * first appeared in glibc 2.7.\n- */\n-#if defined(CPU_ALLOC)\n-\tsize_t size;\n-\tcpu_set_t *cpusetp;\n-\n-\tcpusetp = CPU_ALLOC(RTE_MAX_LCORE);\n-\tif (cpusetp == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"CPU_ALLOC failed\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tsize = CPU_ALLOC_SIZE(RTE_MAX_LCORE);\n-\tCPU_ZERO_S(size, cpusetp);\n-\tCPU_SET_S(rte_lcore_id(), size, cpusetp);\n-\n-\tthread = pthread_self();\n-\ts = pthread_setaffinity_np(thread, size, cpusetp);\n-\tif (s != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n-\t\tCPU_FREE(cpusetp);\n-\t\treturn -1;\n-\t}\n-\n-\tCPU_FREE(cpusetp);\n-#else /* CPU_ALLOC */\n-\tcpuset_t cpuset;\n-\tCPU_ZERO( &cpuset );\n-\tCPU_SET( rte_lcore_id(), &cpuset );\n-\n-\tthread = pthread_self();\n-\ts = pthread_setaffinity_np(thread, sizeof( cpuset ), &cpuset);\n-\tif (s != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n-\t\treturn -1;\n-\t}\n-#endif\n-\treturn 0;\n-}\n-\n-void eal_thread_init_master(unsigned lcore_id)\n-{\n-\t/* set the lcore ID in per-lcore memory area */\n-\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n-\n-\t/* set CPU affinity */\n-\tif (eal_thread_set_affinity() < 0)\n-\t\trte_panic(\"cannot set affinity\\n\");\n-}\n-\n-/* main loop of threads */\n-__attribute__((noreturn)) void *\n-eal_thread_loop(__attribute__((unused)) void *arg)\n-{\n-\tchar c;\n-\tint n, ret;\n-\tunsigned lcore_id;\n-\tpthread_t thread_id;\n-\tint m2s, s2m;\n-\n-\tthread_id = pthread_self();\n-\n-\t/* retrieve our lcore_id from the configuration structure */\n-\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n-\t\tif (thread_id == lcore_config[lcore_id].thread_id)\n-\t\t\tbreak;\n-\t}\n-\tif (lcore_id == RTE_MAX_LCORE)\n-\t\trte_panic(\"cannot retrieve lcore id\\n\");\n-\n-\tRTE_LOG(DEBUG, EAL, \"Core %u is ready (tid=%p)\\n\",\n-\t\tlcore_id, thread_id);\n-\n-\tm2s = lcore_config[lcore_id].pipe_master2slave[0];\n-\ts2m = lcore_config[lcore_id].pipe_slave2master[1];\n-\n-\t/* set the lcore ID in per-lcore memory area */\n-\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n-\n-\t/* set CPU affinity */\n-\tif (eal_thread_set_affinity() < 0)\n-\t\trte_panic(\"cannot set affinity\\n\");\n-\n-\t/* read on our pipe to get commands */\n-\twhile (1) {\n-\t\tvoid *fct_arg;\n-\n-\t\t/* wait command */\n-\t\tdo {\n-\t\t\tn = read(m2s, &c, 1);\n-\t\t} while (n < 0 && errno == EINTR);\n-\n-\t\tif (n <= 0)\n-\t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n-\n-\t\tlcore_config[lcore_id].state = RUNNING;\n-\n-\t\t/* send ack */\n-\t\tn = 0;\n-\t\twhile (n == 0 || (n < 0 && errno == EINTR))\n-\t\t\tn = write(s2m, &c, 1);\n-\t\tif (n < 0)\n-\t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n-\n-\t\tif (lcore_config[lcore_id].f == NULL)\n-\t\t\trte_panic(\"NULL function pointer\\n\");\n-\n-\t\t/* call the function and store the return value */\n-\t\tfct_arg = lcore_config[lcore_id].arg;\n-\t\tret = lcore_config[lcore_id].f(fct_arg);\n-\t\tlcore_config[lcore_id].ret = ret;\n-\t\trte_wmb();\n-\t\tlcore_config[lcore_id].state = FINISHED;\n-\t}\n-\n-\t/* never reached */\n-\t/* pthread_exit(NULL); */\n-\t/* return NULL; */\n-}\ndiff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c\nnew file mode 100644\nindex 0000000..9688f9a\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_common_thread.c\n@@ -0,0 +1,248 @@\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 <errno.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <stdint.h>\n+#include <unistd.h>\n+\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+#include <pthread_np.h>\n+#else  /* RTE_EXEC_ENV_BSDAPP */\n+#include <pthread.h>\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\n+#include <sched.h>\n+#include <sys/queue.h>\n+\n+#include <rte_debug.h>\n+#include <rte_atomic.h>\n+#include <rte_launch.h>\n+#include <rte_log.h>\n+#include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_per_lcore.h>\n+#include <rte_tailq.h>\n+#include <rte_eal.h>\n+#include <rte_per_lcore.h>\n+#include <rte_lcore.h>\n+\n+#include \"eal_private.h\"\n+#include \"eal_thread.h\"\n+\n+RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);\n+\n+/*\n+ * Send a message to a slave lcore identified by slave_id to call a\n+ * function f with argument arg. Once the execution is done, the\n+ * remote lcore switch in FINISHED state.\n+ */\n+int\n+rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)\n+{\n+\tint n;\n+\tchar c = 0;\n+\tint m2s = lcore_config[slave_id].pipe_master2slave[1];\n+\tint s2m = lcore_config[slave_id].pipe_slave2master[0];\n+\n+\tif (lcore_config[slave_id].state != WAIT)\n+\t\treturn -EBUSY;\n+\n+\tlcore_config[slave_id].f = f;\n+\tlcore_config[slave_id].arg = arg;\n+\n+\t/* send message */\n+\tn = 0;\n+\twhile (n == 0 || (n < 0 && errno == EINTR))\n+\t\tn = write(m2s, &c, 1);\n+\tif (n < 0)\n+\t\trte_panic(\"cannot write on configuration pipe\\n\");\n+\n+\t/* wait ack */\n+\tdo {\n+\t\tn = read(s2m, &c, 1);\n+\t} while (n < 0 && errno == EINTR);\n+\n+\tif (n <= 0)\n+\t\trte_panic(\"cannot read on configuration pipe\\n\");\n+\n+\treturn 0;\n+}\n+\n+/* set affinity for current thread */\n+static int\n+eal_thread_set_affinity(void)\n+{\n+\tint s;\n+\tpthread_t thread;\n+\n+/*\n+ * According to the section VERSIONS of the CPU_ALLOC man page:\n+ *\n+ * The CPU_ZERO(), CPU_SET(), CPU_CLR(), and CPU_ISSET() macros were added\n+ * in glibc 2.3.3.\n+ *\n+ * CPU_COUNT() first appeared in glibc 2.6.\n+ *\n+ * CPU_AND(),     CPU_OR(),     CPU_XOR(),    CPU_EQUAL(),    CPU_ALLOC(),\n+ * CPU_ALLOC_SIZE(), CPU_FREE(), CPU_ZERO_S(),  CPU_SET_S(),  CPU_CLR_S(),\n+ * CPU_ISSET_S(),  CPU_AND_S(), CPU_OR_S(), CPU_XOR_S(), and CPU_EQUAL_S()\n+ * first appeared in glibc 2.7.\n+ */\n+#if defined(CPU_ALLOC)\n+\tsize_t size;\n+\tcpu_set_t *cpusetp;\n+\n+\tcpusetp = CPU_ALLOC(RTE_MAX_LCORE);\n+\tif (cpusetp == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"CPU_ALLOC failed\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tsize = CPU_ALLOC_SIZE(RTE_MAX_LCORE);\n+\tCPU_ZERO_S(size, cpusetp);\n+\tCPU_SET_S(rte_lcore_id(), size, cpusetp);\n+\n+\tthread = pthread_self();\n+\ts = pthread_setaffinity_np(thread, size, cpusetp);\n+\tif (s != 0) {\n+\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n+\t\tCPU_FREE(cpusetp);\n+\t\treturn -1;\n+\t}\n+\n+\tCPU_FREE(cpusetp);\n+#else /* CPU_ALLOC */\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+\tcpuset_t cpuset;\n+#else  /* RTE_EXEC_ENV_BSDAPP */\n+\tcpu_set_t cpuset;\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\tCPU_ZERO(&cpuset);\n+\tCPU_SET(rte_lcore_id(), &cpuset);\n+\n+\tthread = pthread_self();\n+\ts = pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);\n+\tif (s != 0) {\n+\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n+\t\treturn -1;\n+\t}\n+#endif\n+\treturn 0;\n+}\n+\n+void eal_thread_init_master(unsigned lcore_id)\n+{\n+\t/* set the lcore ID in per-lcore memory area */\n+\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n+\n+\t/* set CPU affinity */\n+\tif (eal_thread_set_affinity() < 0)\n+\t\trte_panic(\"cannot set affinity\\n\");\n+}\n+\n+/* main loop of threads */\n+__attribute__((noreturn)) void *\n+eal_thread_loop(__attribute__((unused)) void *arg)\n+{\n+\tchar c;\n+\tint n, ret;\n+\tunsigned lcore_id;\n+\tpthread_t thread_id;\n+\tint m2s, s2m;\n+\n+\tthread_id = pthread_self();\n+\n+\t/* retrieve our lcore_id from the configuration structure */\n+\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n+\t\tif (thread_id == lcore_config[lcore_id].thread_id)\n+\t\t\tbreak;\n+\t}\n+\tif (lcore_id == RTE_MAX_LCORE)\n+\t\trte_panic(\"cannot retrieve lcore id\\n\");\n+\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+\tRTE_LOG(DEBUG, EAL, \"Core %u is ready (tid=%p)\\n\",\n+\t\tlcore_id, thread_id);\n+#else  /* RTE_EXEC_ENV_BSDAPP */\n+\tRTE_LOG(DEBUG, EAL, \"Core %u is ready (tid=%x)\\n\",\n+\t\tlcore_id, (int)thread_id);\n+#endif /* RTE_EXEC_ENV_BSDAPP */\n+\n+\tm2s = lcore_config[lcore_id].pipe_master2slave[0];\n+\ts2m = lcore_config[lcore_id].pipe_slave2master[1];\n+\n+\t/* set the lcore ID in per-lcore memory area */\n+\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n+\n+\t/* set CPU affinity */\n+\tif (eal_thread_set_affinity() < 0)\n+\t\trte_panic(\"cannot set affinity\\n\");\n+\n+\t/* read on our pipe to get commands */\n+\twhile (1) {\n+\t\tvoid *fct_arg;\n+\n+\t\t/* wait command */\n+\t\tdo {\n+\t\t\tn = read(m2s, &c, 1);\n+\t\t} while (n < 0 && errno == EINTR);\n+\n+\t\tif (n <= 0)\n+\t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n+\n+\t\tlcore_config[lcore_id].state = RUNNING;\n+\n+\t\t/* send ack */\n+\t\tn = 0;\n+\t\twhile (n == 0 || (n < 0 && errno == EINTR))\n+\t\t\tn = write(s2m, &c, 1);\n+\t\tif (n < 0)\n+\t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n+\n+\t\tif (lcore_config[lcore_id].f == NULL)\n+\t\t\trte_panic(\"NULL function pointer\\n\");\n+\n+\t\t/* call the function and store the return value */\n+\t\tfct_arg = lcore_config[lcore_id].arg;\n+\t\tret = lcore_config[lcore_id].f(fct_arg);\n+\t\tlcore_config[lcore_id].ret = ret;\n+\t\trte_wmb();\n+\t\tlcore_config[lcore_id].state = FINISHED;\n+\t}\n+\n+\t/* never reached */\n+\t/* pthread_exit(NULL); */\n+\t/* return NULL; */\n+}\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 87b9bfc..9252333 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -56,7 +56,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_memory.c\n ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_xen_memory.c\n endif\n-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_thread.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_log.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c\n@@ -85,9 +84,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c\n 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 \n CFLAGS_eal.o := -D_GNU_SOURCE\n-CFLAGS_eal_thread.o := -D_GNU_SOURCE\n+CFLAGS_eal_common_thread.o := -D_GNU_SOURCE\n CFLAGS_eal_log.o := -D_GNU_SOURCE\n CFLAGS_eal_common_log.o := -D_GNU_SOURCE\n CFLAGS_eal_hugepage_info.o := -D_GNU_SOURCE\n@@ -98,7 +98,7 @@ CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE\n # workaround for a gcc bug with noreturn attribute\n # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603\n ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)\n-CFLAGS_eal_thread.o += -Wno-return-type\n+CFLAGS_eal_common_thread.o += -Wno-return-type\n endif\n \n INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c\ndeleted file mode 100644\nindex 80a985f..0000000\n--- a/lib/librte_eal/linuxapp/eal/eal_thread.c\n+++ /dev/null\n@@ -1,233 +0,0 @@\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 <errno.h>\n-#include <stdio.h>\n-#include <stdlib.h>\n-#include <stdint.h>\n-#include <unistd.h>\n-#include <pthread.h>\n-#include <sched.h>\n-#include <sys/queue.h>\n-\n-#include <rte_debug.h>\n-#include <rte_atomic.h>\n-#include <rte_launch.h>\n-#include <rte_log.h>\n-#include <rte_memory.h>\n-#include <rte_memzone.h>\n-#include <rte_per_lcore.h>\n-#include <rte_tailq.h>\n-#include <rte_eal.h>\n-#include <rte_per_lcore.h>\n-#include <rte_lcore.h>\n-\n-#include \"eal_private.h\"\n-#include \"eal_thread.h\"\n-\n-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);\n-\n-/*\n- * Send a message to a slave lcore identified by slave_id to call a\n- * function f with argument arg. Once the execution is done, the\n- * remote lcore switch in FINISHED state.\n- */\n-int\n-rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)\n-{\n-\tint n;\n-\tchar c = 0;\n-\tint m2s = lcore_config[slave_id].pipe_master2slave[1];\n-\tint s2m = lcore_config[slave_id].pipe_slave2master[0];\n-\n-\tif (lcore_config[slave_id].state != WAIT)\n-\t\treturn -EBUSY;\n-\n-\tlcore_config[slave_id].f = f;\n-\tlcore_config[slave_id].arg = arg;\n-\n-\t/* send message */\n-\tn = 0;\n-\twhile (n == 0 || (n < 0 && errno == EINTR))\n-\t\tn = write(m2s, &c, 1);\n-\tif (n < 0)\n-\t\trte_panic(\"cannot write on configuration pipe\\n\");\n-\n-\t/* wait ack */\n-\tdo {\n-\t\tn = read(s2m, &c, 1);\n-\t} while (n < 0 && errno == EINTR);\n-\n-\tif (n <= 0)\n-\t\trte_panic(\"cannot read on configuration pipe\\n\");\n-\n-\treturn 0;\n-}\n-\n-/* set affinity for current thread */\n-static int\n-eal_thread_set_affinity(void)\n-{\n-\tint s;\n-\tpthread_t thread;\n-\n-/*\n- * According to the section VERSIONS of the CPU_ALLOC man page:\n- *\n- * The CPU_ZERO(), CPU_SET(), CPU_CLR(), and CPU_ISSET() macros were added\n- * in glibc 2.3.3.\n- *\n- * CPU_COUNT() first appeared in glibc 2.6.\n- *\n- * CPU_AND(),     CPU_OR(),     CPU_XOR(),    CPU_EQUAL(),    CPU_ALLOC(),\n- * CPU_ALLOC_SIZE(), CPU_FREE(), CPU_ZERO_S(),  CPU_SET_S(),  CPU_CLR_S(),\n- * CPU_ISSET_S(),  CPU_AND_S(), CPU_OR_S(), CPU_XOR_S(), and CPU_EQUAL_S()\n- * first appeared in glibc 2.7.\n- */\n-#if defined(CPU_ALLOC)\n-\tsize_t size;\n-\tcpu_set_t *cpusetp;\n-\n-\tcpusetp = CPU_ALLOC(RTE_MAX_LCORE);\n-\tif (cpusetp == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"CPU_ALLOC failed\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tsize = CPU_ALLOC_SIZE(RTE_MAX_LCORE);\n-\tCPU_ZERO_S(size, cpusetp);\n-\tCPU_SET_S(rte_lcore_id(), size, cpusetp);\n-\n-\tthread = pthread_self();\n-\ts = pthread_setaffinity_np(thread, size, cpusetp);\n-\tif (s != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n-\t\tCPU_FREE(cpusetp);\n-\t\treturn -1;\n-\t}\n-\n-\tCPU_FREE(cpusetp);\n-#else /* CPU_ALLOC */\n-\tcpu_set_t cpuset;\n-\tCPU_ZERO( &cpuset );\n-\tCPU_SET( rte_lcore_id(), &cpuset );\n-\n-\tthread = pthread_self();\n-\ts = pthread_setaffinity_np(thread, sizeof( cpuset ), &cpuset);\n-\tif (s != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"pthread_setaffinity_np failed\\n\");\n-\t\treturn -1;\n-\t}\n-#endif\n-\treturn 0;\n-}\n-\n-void eal_thread_init_master(unsigned lcore_id)\n-{\n-\t/* set the lcore ID in per-lcore memory area */\n-\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n-\n-\t/* set CPU affinity */\n-\tif (eal_thread_set_affinity() < 0)\n-\t\trte_panic(\"cannot set affinity\\n\");\n-}\n-\n-/* main loop of threads */\n-__attribute__((noreturn)) void *\n-eal_thread_loop(__attribute__((unused)) void *arg)\n-{\n-\tchar c;\n-\tint n, ret;\n-\tunsigned lcore_id;\n-\tpthread_t thread_id;\n-\tint m2s, s2m;\n-\n-\tthread_id = pthread_self();\n-\n-\t/* retrieve our lcore_id from the configuration structure */\n-\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n-\t\tif (thread_id == lcore_config[lcore_id].thread_id)\n-\t\t\tbreak;\n-\t}\n-\tif (lcore_id == RTE_MAX_LCORE)\n-\t\trte_panic(\"cannot retrieve lcore id\\n\");\n-\n-\tRTE_LOG(DEBUG, EAL, \"Core %u is ready (tid=%x)\\n\",\n-\t\tlcore_id, (int)thread_id);\n-\n-\tm2s = lcore_config[lcore_id].pipe_master2slave[0];\n-\ts2m = lcore_config[lcore_id].pipe_slave2master[1];\n-\n-\t/* set the lcore ID in per-lcore memory area */\n-\tRTE_PER_LCORE(_lcore_id) = lcore_id;\n-\n-\t/* set CPU affinity */\n-\tif (eal_thread_set_affinity() < 0)\n-\t\trte_panic(\"cannot set affinity\\n\");\n-\n-\t/* read on our pipe to get commands */\n-\twhile (1) {\n-\t\tvoid *fct_arg;\n-\n-\t\t/* wait command */\n-\t\tdo {\n-\t\t\tn = read(m2s, &c, 1);\n-\t\t} while (n < 0 && errno == EINTR);\n-\n-\t\tif (n <= 0)\n-\t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n-\n-\t\tlcore_config[lcore_id].state = RUNNING;\n-\n-\t\t/* send ack */\n-\t\tn = 0;\n-\t\twhile (n == 0 || (n < 0 && errno == EINTR))\n-\t\t\tn = write(s2m, &c, 1);\n-\t\tif (n < 0)\n-\t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n-\n-\t\tif (lcore_config[lcore_id].f == NULL)\n-\t\t\trte_panic(\"NULL function pointer\\n\");\n-\n-\t\t/* call the function and store the return value */\n-\t\tfct_arg = lcore_config[lcore_id].arg;\n-\t\tret = lcore_config[lcore_id].f(fct_arg);\n-\t\tlcore_config[lcore_id].ret = ret;\n-\t\trte_wmb();\n-\t\tlcore_config[lcore_id].state = FINISHED;\n-\t}\n-\n-\t/* never reached */\n-\t/* pthread_exit(NULL); */\n-\t/* return NULL; */\n-}\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "2/7"
    ]
}