Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/41753/?format=api
http://patchwork.dpdk.org/api/patches/41753/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20180628015247.42232-3-qi.z.zhang@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20180628015247.42232-3-qi.z.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180628015247.42232-3-qi.z.zhang@intel.com", "date": "2018-06-28T01:52:30", "name": "[v6,02/19] eal: enable multi process init callback", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1dcf99ea78b336811d5ac2768e860f90ff504b6d", "submitter": { "id": 504, "url": "http://patchwork.dpdk.org/api/people/504/?format=api", "name": "Qi Zhang", "email": "qi.z.zhang@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20180628015247.42232-3-qi.z.zhang@intel.com/mbox/", "series": [ { "id": 278, "url": "http://patchwork.dpdk.org/api/series/278/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=278", "date": "2018-06-28T01:52:28", "name": "enable hotplug on multi-process", "version": 6, "mbox": "http://patchwork.dpdk.org/series/278/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/41753/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/41753/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2C87B1B1F7;\n\tThu, 28 Jun 2018 03:52:29 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id E10A17EB4\n\tfor <dev@dpdk.org>; Thu, 28 Jun 2018 03:52:20 +0200 (CEST)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2018 18:52:20 -0700", "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga008.jf.intel.com with ESMTP; 27 Jun 2018 18:52:18 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,281,1526367600\"; d=\"scan'208\";a=\"52818134\"", "From": "Qi Zhang <qi.z.zhang@intel.com>", "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com", "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>", "Date": "Thu, 28 Jun 2018 09:52:30 +0800", "Message-Id": "<20180628015247.42232-3-qi.z.zhang@intel.com>", "X-Mailer": "git-send-email 2.13.6", "In-Reply-To": "<20180628015247.42232-1-qi.z.zhang@intel.com>", "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180628015247.42232-1-qi.z.zhang@intel.com>", "Subject": "[dpdk-dev] [PATCH v6 02/19] eal: enable multi process init callback", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "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>\n---\n lib/librte_eal/common/eal_common_proc.c | 51 ++++++++++++++++++++++++++++++++-\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 4 files changed, 91 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nindex f010ef59e..de87925c8 100644\n--- a/lib/librte_eal/common/eal_common_proc.c\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -619,6 +619,42 @@ 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@@ -686,7 +722,20 @@ rte_mp_channel_init(void)\n \tflock(dir_fd, LOCK_UN);\n \tclose(dir_fd);\n \n-\treturn 0;\n+\treturn process_mp_init_callbacks();\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 \n", "prefixes": [ "v6", "02/19" ] }{ "id": 41753, "url": "