Show a patch.

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

{
    "id": 41619,
    "url": "http://patches.dpdk.org/api/patches/41619/?format=api",
    "web_url": "http://patches.dpdk.org/patch/41619/",
    "project": {
        "id": 1,
        "url": "http://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"
    },
    "msgid": "<20180627071740.19870-5-qi.z.zhang@intel.com>",
    "date": "2018-06-27T07:17:20",
    "name": "[v5,04/24] eal: enable multi process init callback",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1dcf99ea78b336811d5ac2768e860f90ff504b6d",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Zhang, Qi Z",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/41619/mbox/",
    "series": [
        {
            "id": 252,
            "url": "http://patches.dpdk.org/api/series/252/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=252",
            "date": "2018-06-27T07:17:16",
            "name": "enable hotplug on multi-process",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/252/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41619/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41619/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,278,1526367600\"; d=\"scan'208\";a=\"52236098\"",
        "X-Amp-File-Uploaded": "False",
        "Precedence": "list",
        "X-Mailman-Version": "2.1.15",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180627071740.19870-1-qi.z.zhang@intel.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v5 04/24] eal: enable multi process init callback",
        "Sender": "\"dev\" <dev-bounces@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 0BF141BDD5;\n\tWed, 27 Jun 2018 09:17:24 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 8F1AD1B5F3\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 09:17:16 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2018 00:17:16 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 27 Jun 2018 00:17:14 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Mailer": "git-send-email 2.13.6",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-ExtLoop1": "1",
        "Date": "Wed, 27 Jun 2018 15:17:20 +0800",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "In-Reply-To": "<20180627071740.19870-1-qi.z.zhang@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>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20180627071740.19870-5-qi.z.zhang@intel.com>",
        "Return-Path": "<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>\nAcked-by: Anatoly Burakov <anatoly.burakov@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 707d8ab30..fc0eb4d17 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": [
        "v5",
        "04/24"
    ]
}