Show a patch.

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

{
    "id": 42040,
    "url": "http://patches.dpdk.org/api/patches/42040/",
    "web_url": "http://patches.dpdk.org/patch/42040/",
    "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-7-qi.z.zhang@intel.com>",
    "date": "2018-07-02T05:44:37",
    "name": "[v8,06/19] ethdev: support attach private device as first",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9d14553f7757c21b6121a5e1f1c0ceacba0fab8f",
    "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/42040/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/42040/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42040/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 A0CF75B3C;\n\tMon,  2 Jul 2018 07:44:37 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id D11FF58C4\n\tfor <dev@dpdk.org>; Mon,  2 Jul 2018 07:44:29 +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:29 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 01 Jul 2018 22:44:25 -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-7-qi.z.zhang@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,298,1526367600\"; d=\"scan'208\";a=\"53378958\"",
        "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:37 +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 06/19] ethdev: support attach private device\n\tas first"
    },
    "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 8d13da591..28f89dba9 100644\n--- a/lib/librte_ethdev/ethdev_mp.c\n+++ b/lib/librte_ethdev/ethdev_mp.c\n@@ -189,6 +189,8 @@ __handle_secondary_request(void *param)\n \t\t} else {\n \t\t\tret = tmp_req.result;\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 7d89d9f95..408a49f44 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@@ -433,7 +442,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@@ -488,7 +497,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@@ -505,7 +514,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@@ -520,7 +529,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@@ -542,7 +551,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": [
        "v8",
        "06/19"
    ]
}