Show a patch.

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

{
    "id": 42036,
    "url": "http://patches.dpdk.org/api/patches/42036/",
    "web_url": "http://patches.dpdk.org/patch/42036/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180702054450.29269-3-qi.z.zhang@intel.com>",
    "date": "2018-07-02T05:44:33",
    "name": "[v8,02/19] eal: enable multi process init callback",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "044b786f0418138a892a8a491fce0f7797368e20",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/",
        "name": "Zhang, Qi Z",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/42036/mbox/",
    "series": [
        {
            "id": 344,
            "url": "http://patches.dpdk.org/api/series/344/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=344",
            "date": "2018-07-02T05:44:31",
            "name": "enable hotplug on multi-process",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/344/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42036/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42036/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.13.6",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D5E6F58C6;\n\tMon,  2 Jul 2018 07:44:29 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 0C50B4F9B\n\tfor <dev@dpdk.org>; Mon,  2 Jul 2018 07:44:24 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Jul 2018 22:44:23 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 01 Jul 2018 22:44:17 -0700"
        ],
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180702054450.29269-1-qi.z.zhang@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20180702054450.29269-3-qi.z.zhang@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,298,1526367600\"; d=\"scan'208\";a=\"53378931\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<20180702054450.29269-1-qi.z.zhang@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Mon,  2 Jul 2018 13:44:33 +0800",
        "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, \n\tferruh.yigit@intel.com, benjamin.h.shelton@intel.com,\n\tnarender.vangati@intel.com, Qi Zhang <qi.z.zhang@intel.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v8 02/19] eal: enable multi process init callback"
    },
    "content": "Introduce new API rte_eal_register_mp_init that help to register\na callback function which will be invoked right after multi-process\nchannel be established (rte_mp_channel_init). Typically the API\nwill be used by other module that want it's mp channel action callbacks\ncan be registered during rte_eal_init automatically.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_proc.c | 57 +++++++++++++++++++++++++++++++--\n lib/librte_eal/common/eal_private.h     |  5 +++\n lib/librte_eal/common/include/rte_eal.h | 34 ++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal.c       |  2 ++\n lib/librte_eal/rte_eal_version.map      |  1 +\n 5 files changed, 97 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nindex f010ef59e..f6d7c83e4 100644\n--- a/lib/librte_eal/common/eal_common_proc.c\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -619,11 +619,47 @@ unlink_sockets(const char *filter)\n \treturn 0;\n }\n \n+struct mp_init_entry {\n+\tTAILQ_ENTRY(mp_init_entry) next;\n+\trte_eal_mp_init_callback_t callback;\n+};\n+\n+TAILQ_HEAD(mp_init_entry_list, mp_init_entry);\n+static struct mp_init_entry_list mp_init_entry_list =\n+\tTAILQ_HEAD_INITIALIZER(mp_init_entry_list);\n+\n+static int process_mp_init_callbacks(void)\n+{\n+\tstruct mp_init_entry *entry;\n+\tint ret;\n+\n+\tTAILQ_FOREACH(entry, &mp_init_entry_list, next) {\n+\t\tret = entry->callback();\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\treturn 0;\n+}\n+\n+int __rte_experimental\n+rte_eal_register_mp_init(rte_eal_mp_init_callback_t callback)\n+{\n+\tstruct mp_init_entry *entry = calloc(1, sizeof(struct mp_init_entry));\n+\n+\tif (entry == NULL)\n+\t\treturn -ENOMEM;\n+\n+\tentry->callback = callback;\n+\tTAILQ_INSERT_TAIL(&mp_init_entry_list, entry, next);\n+\n+\treturn 0;\n+}\n+\n int\n rte_mp_channel_init(void)\n {\n \tchar path[PATH_MAX];\n-\tint dir_fd;\n+\tint dir_fd, ret;\n \tpthread_t mp_handle_tid, async_reply_handle_tid;\n \n \t/* create filter path */\n@@ -686,7 +722,24 @@ rte_mp_channel_init(void)\n \tflock(dir_fd, LOCK_UN);\n \tclose(dir_fd);\n \n-\treturn 0;\n+\tret = process_mp_init_callbacks();\n+\tif (ret)\n+\t\tRTE_LOG(ERR, EAL, \"failed to process mp init callbacks\\n\");\n+\n+\treturn ret;\n+}\n+\n+void rte_mp_init_callback_cleanup(void)\n+{\n+\tstruct mp_init_entry *entry;\n+\n+\twhile (!TAILQ_EMPTY(&mp_init_entry_list)) {\n+\t\tTAILQ_FOREACH(entry, &mp_init_entry_list, next) {\n+\t\t\tTAILQ_REMOVE(&mp_init_entry_list, entry, next);\n+\t\t\tfree(entry);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n }\n \n /**\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex bdadc4d50..bc230ee23 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -247,6 +247,11 @@ struct rte_bus *rte_bus_find_by_device_name(const char *str);\n int rte_mp_channel_init(void);\n \n /**\n+ * Cleanup all mp channel init callbacks.\n+ */\n+void rte_mp_init_callback_cleanup(void);\n+\n+/**\n  * Internal Executes all the user application registered callbacks for\n  * the specific device. It is for DPDK internal user only. User\n  * application should not call it directly.\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 8de5d69e8..506f17f34 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -512,6 +512,40 @@ __rte_deprecated\n const char *\n rte_eal_mbuf_default_mempool_ops(void);\n \n+/**\n+ * Callback function right after multi-process channel be established.\n+ * Typical implementation of these functions is to register mp channel\n+ * action callbacks\n+ *\n+ * @return\n+ *  - 0 on success.\n+ *  - (<0) on failure.\n+ */\n+typedef int (*rte_eal_mp_init_callback_t)(void);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Register a callback function that will be invoked right after\n+ * multi-process channel be established (rte_mp_channel_init). Typically\n+ * the function is used by other module that want it's mp channel\n+ * action callbacks can be registered during rte_eal_init automatically.\n+ *\n+ * @note\n+ *   This function only take effect when be called before rte_eal_init,\n+ *   and all registered callback will be clear during rte_eal_cleanup.\n+ *\n+ * @param callback\n+ *   function be called at that moment.\n+ *\n+ * @return\n+ *  - 0 on success.\n+ *  - (<0) on failure.\n+ */\n+int __rte_experimental\n+rte_eal_register_mp_init(rte_eal_mp_init_callback_t callback);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 8655b8691..45cccff7e 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -1048,6 +1048,8 @@ int __rte_experimental\n rte_eal_cleanup(void)\n {\n \trte_service_finalize();\n+\trte_mp_init_callback_cleanup();\n+\n \treturn 0;\n }\n \ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex f7dd0e7bc..67e3548e8 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -260,6 +260,7 @@ EXPERIMENTAL {\n \trte_eal_hotplug_add;\n \trte_eal_hotplug_remove;\n \trte_eal_mbuf_user_pool_ops;\n+\trte_eal_register_mp_init;\n \trte_fbarray_attach;\n \trte_fbarray_destroy;\n \trte_fbarray_detach;\n",
    "prefixes": [
        "v8",
        "02/19"
    ]
}