Show a patch.

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

{
    "id": 41623,
    "url": "http://patches.dpdk.org/api/patches/41623/?format=api",
    "web_url": "http://patches.dpdk.org/patch/41623/",
    "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-9-qi.z.zhang@intel.com>",
    "date": "2018-06-27T07:17:24",
    "name": "[v5,08/24] ethdev: support attach private device as first",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f0d76e17247205f4e6df9a24a7ca816b4206c1b2",
    "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/41623/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/41623/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41623/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=\"52236183\"",
        "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 08/24] ethdev: support attach private device\n\tas first",
        "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 854961BDF1;\n\tWed, 27 Jun 2018 09:17:39 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id D33DC1BDD3\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 09:17:23 +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:23 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 27 Jun 2018 00:17:21 -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:24 +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-9-qi.z.zhang@intel.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "When attach a private device from secondary as the first one, we need\nto make sure rte_eth_dev_shared_data is initialized, the patch add\nnecessary IPC for secondary to inform primary to do initialization.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n lib/librte_ethdev/ethdev_mp.c      |  2 ++\n lib/librte_ethdev/ethdev_mp.h      |  1 +\n lib/librte_ethdev/ethdev_private.h |  3 +++\n lib/librte_ethdev/rte_ethdev.c     | 31 ++++++++++++++++++++-----------\n 4 files changed, 26 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/lib/librte_ethdev/ethdev_mp.c b/lib/librte_ethdev/ethdev_mp.c\nindex 0a93fa669..f2982c790 100644\n--- a/lib/librte_ethdev/ethdev_mp.c\n+++ b/lib/librte_ethdev/ethdev_mp.c\n@@ -182,6 +182,8 @@ __handle_secondary_request(void *param)\n \t\t\t\tret = tmp_req.result;\n \t\t\t}\n \t\t}\n+\t} else if (req->t == REQ_TYPE_SHARE_DATA_PREPARE) {\n+\t\teth_dev_shared_data_prepare();\n \t} else {\n \t\tethdev_log(ERR, \"unsupported secondary to primary request\\n\");\n \t\tret = -ENOTSUP;\ndiff --git a/lib/librte_ethdev/ethdev_mp.h b/lib/librte_ethdev/ethdev_mp.h\nindex 40be46c89..61fc381da 100644\n--- a/lib/librte_ethdev/ethdev_mp.h\n+++ b/lib/librte_ethdev/ethdev_mp.h\n@@ -15,6 +15,7 @@ enum eth_dev_req_type {\n \tREQ_TYPE_PRE_DETACH,\n \tREQ_TYPE_DETACH,\n \tREQ_TYPE_ATTACH_ROLLBACK,\n+\tREQ_TYPE_SHARE_DATA_PREPARE,\n };\n \n struct eth_dev_mp_req {\ndiff --git a/lib/librte_ethdev/ethdev_private.h b/lib/librte_ethdev/ethdev_private.h\nindex 981e7de8a..005d63afc 100644\n--- a/lib/librte_ethdev/ethdev_private.h\n+++ b/lib/librte_ethdev/ethdev_private.h\n@@ -36,4 +36,7 @@ int do_eth_dev_attach(const char *devargs, uint16_t *port_id);\n  */\n int do_eth_dev_detach(uint16_t port_id);\n \n+/* Prepare shared data for multi-process */\n+void eth_dev_shared_data_prepare(void);\n+\n #endif\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex 54d3d2369..c0f68fe09 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -199,11 +199,14 @@ rte_eth_find_next(uint16_t port_id)\n \treturn port_id;\n }\n \n-static void\n-rte_eth_dev_shared_data_prepare(void)\n+void\n+eth_dev_shared_data_prepare(void)\n {\n \tconst unsigned flags = 0;\n \tconst struct rte_memzone *mz;\n+\tstruct eth_dev_mp_req req;\n+\n+\tmemset(&req, 0, sizeof(req));\n \n \trte_spinlock_lock(&rte_eth_shared_data_lock);\n \n@@ -215,6 +218,12 @@ rte_eth_dev_shared_data_prepare(void)\n \t\t\t\t\trte_socket_id(), flags);\n \t\t} else\n \t\t\tmz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);\n+\t\t/* if secondary attach a private device first */\n+\t\tif (mz == NULL && rte_eal_process_type() != RTE_PROC_PRIMARY) {\n+\t\t\treq.t = REQ_TYPE_SHARE_DATA_PREPARE;\n+\t\t\teth_dev_request_to_primary(&req);\n+\t\t\tmz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);\n+\t\t}\n \t\tif (mz == NULL)\n \t\t\trte_panic(\"Cannot allocate ethdev shared data\\n\");\n \n@@ -255,7 +264,7 @@ rte_eth_dev_allocated(const char *name)\n {\n \tstruct rte_eth_dev *ethdev;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n@@ -300,7 +309,7 @@ rte_eth_dev_allocate(const char *name)\n \tuint16_t port_id;\n \tstruct rte_eth_dev *eth_dev = NULL;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \t/* Synchronize port creation between primary and secondary threads. */\n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n@@ -339,7 +348,7 @@ rte_eth_dev_attach_secondary(const char *name)\n \tuint16_t i;\n \tstruct rte_eth_dev *eth_dev = NULL;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \t/* Synchronize port attachment to primary port creation and release. */\n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n@@ -379,7 +388,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)\n \tif (eth_dev == NULL)\n \t\treturn -EINVAL;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \t_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL);\n \n@@ -432,7 +441,7 @@ rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id)\n int __rte_experimental\n rte_eth_dev_owner_new(uint64_t *owner_id)\n {\n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n@@ -487,7 +496,7 @@ rte_eth_dev_owner_set(const uint16_t port_id,\n {\n \tint ret;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n@@ -504,7 +513,7 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)\n \t\t\t{.id = RTE_ETH_DEV_NO_OWNER, .name = \"\"};\n \tint ret;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n@@ -519,7 +528,7 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)\n {\n \tuint16_t port_id;\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n@@ -541,7 +550,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)\n \tint ret = 0;\n \tstruct rte_eth_dev *ethdev = &rte_eth_devices[port_id];\n \n-\trte_eth_dev_shared_data_prepare();\n+\teth_dev_shared_data_prepare();\n \n \trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n \n",
    "prefixes": [
        "v5",
        "08/24"
    ]
}