get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96463,
    "url": "http://patchwork.dpdk.org/api/patches/96463/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210730135533.417611-4-thomas@monjalon.net/",
    "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": "<20210730135533.417611-4-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210730135533.417611-4-thomas@monjalon.net",
    "date": "2021-07-30T13:55:29",
    "name": "[RFC,v2,3/7] hcdev: add child device representing a device context",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "33377dae11f92da46313988722cbedaee8a02b94",
    "submitter": {
        "id": 685,
        "url": "http://patchwork.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "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/20210730135533.417611-4-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 18101,
            "url": "http://patchwork.dpdk.org/api/series/18101/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18101",
            "date": "2021-07-30T13:55:26",
            "name": "heterogeneous computing library",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/18101/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/96463/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/96463/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id EA94AA0A0C;\n\tFri, 30 Jul 2021 15:56:16 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B19C54067A;\n\tFri, 30 Jul 2021 15:56:14 +0200 (CEST)",
            "from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com\n [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 69ABA410FB\n for <dev@dpdk.org>; Fri, 30 Jul 2021 15:56:13 +0200 (CEST)",
            "from compute3.internal (compute3.nyi.internal [10.202.2.43])\n by mailout.nyi.internal (Postfix) with ESMTP id 203FA5C00C9;\n Fri, 30 Jul 2021 09:56:13 -0400 (EDT)",
            "from mailfrontend1 ([10.202.2.162])\n by compute3.internal (MEProxy); Fri, 30 Jul 2021 09:56:13 -0400",
            "by mail.messagingengine.com (Postfix) with ESMTPA; Fri,\n 30 Jul 2021 09:56:11 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=fm1; bh=hPce/qfuIG4LU\n gLU2qhBPlHU0uGEJzBN53FnbAns2ns=; b=wJelnuyNyVb0bW5/AYkPIjxlZzi6h\n nFmix5UIK3h9eJOj2/BflxfexMv2zEGmClpLDVBj3LC/WmR/7H+LxIm3b7Iqu4nb\n uHEvoil62qhY5f3nsQlblMmF+sICCGjeBRDREKVBS1AwfqMVsxoRUXey3bWKnSuH\n pp+p8cXohoBCDtZPEzZ9EiokIBTmGH/PIEXkZVrUJAl0mmNyDWcnq+2iLtoDXyxS\n JXFduFLbL3Dmm5WBihEUGgpl7In8LUaAzTV09tVlguDsLkeIWWuuiTKAwLvfUkt0\n p2kcUuTfiDOx5Yrl9rAMJ75+KPvMtQLRzarQrugYCOh9kctPCMwQ722Fg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm3; bh=hPce/qfuIG4LUgLU2qhBPlHU0uGEJzBN53FnbAns2ns=; b=SL0rJ4N5\n D0BcbRMVeYndb+Juu8inNEAN0s+GoDBawqDr+pu6asiQ2M5SZm4LIrTHcgDYMx/e\n /R2ERY50chaEma8/96k1qGU7RVsyX70sP0DW7dSpVl863KYekkgKZn1Dj9PTffY7\n 1G2XD6S4ubornVyc9NHhEcizmKsilr0keGwAuKHH8dhEu1WXxtHjidNR0D4k9iR7\n Jr14pB2eSwHZbB5s+7rYVB+iiE3t0TDUJ3G1qf705SCigJsAIRQ9ofTTF/Rrtpzt\n aFahECVeCvTtJVPaoomNlCu0vCY1m1dXYn+yfYwZi+wacRcaBYS7wf49n7H7Ktu9\n 2zYqz/c1n5cyog=="
        ],
        "X-ME-Sender": "<xms:_AQEYcS-Jeh5VPGRSK25CDNkIu-EC6DINOerpHSSYtEwoxf0RO6K8A>\n <xme:_AQEYZxtHN4bNjDBz0RcKerMMpsF0M-CeLYhc35aRut8jhvsZJxIJmqnzvqw2poL9\n DI72fYmxKpzGskwAQ>",
        "X-ME-Received": "\n <xmr:_AQEYZ0rxWdrwXJSGwrRuMOHPlkjKPYLH9e9Go4DvyYY9-apNABL88XJWSrCuwtY1v0KdaDNLb-Gkq_7ZZZnbaInOi93ZjI>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgedvtddrheehgdeiiecutefuodetggdotefrodftvf\n curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu\n uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc\n fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs\n ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf\n frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu\n tdehtdegveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh\n hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght",
        "X-ME-Proxy": "<xmx:_QQEYQAMwvMlZWn3dYKIpWHGWvvXC_qD384Vo63x2IhuO60BV2jC3w>\n <xmx:_QQEYVjgqmwGlN-D9jxHK3yWIXr7g93NKQZqGWiHjFV-Sy--CgoDDQ>\n <xmx:_QQEYcoxV2yTtK2EDH70QjMBcTZmFCs7rgWJ10S7Y0KT6y7iA4w-ow>\n <xmx:_QQEYWU1Or5bpp5AAcrKdP9DqIRZKCnmMVsbPXGA8ea0o4azwexr0w>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n David Marchand <david.marchand@redhat.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Haiyue Wang <haiyue.wang@intel.com>,\n Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,\n Jerin Jacob <jerinj@marvell.com>, Ferruh Yigit <ferruh.yigit@intel.com>,\n Elena Agostini <eagostini@nvidia.com>, Ray Kinsella <mdr@ashroe.eu>",
        "Date": "Fri, 30 Jul 2021 15:55:29 +0200",
        "Message-Id": "<20210730135533.417611-4-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210730135533.417611-1-thomas@monjalon.net>",
        "References": "<20210602203531.2288645-1-thomas@monjalon.net>\n <20210730135533.417611-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [RFC PATCH v2 3/7] hcdev: add child device representing\n a device context",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The computing device may operate in some isolated contexts.\nMemory and processing are isolated in a silo represented by\na child device.\nThe context is provided as an opaque by the caller of\nrte_hcdev_add_child().\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\n---\n lib/hcdev/hcdev.c        | 45 ++++++++++++++++++++++++--\n lib/hcdev/hcdev_driver.h |  2 +-\n lib/hcdev/rte_hcdev.h    | 69 +++++++++++++++++++++++++++++++++++++---\n lib/hcdev/version.map    |  1 +\n 4 files changed, 110 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/hcdev/hcdev.c b/lib/hcdev/hcdev.c\nindex 2a7ce1ccd8..d40010749a 100644\n--- a/lib/hcdev/hcdev.c\n+++ b/lib/hcdev/hcdev.c\n@@ -79,13 +79,22 @@ rte_hcdev_is_valid(int16_t dev_id)\n \treturn false;\n }\n \n+static bool\n+hcdev_match_parent(int16_t dev_id, int16_t parent)\n+{\n+\tif (parent == RTE_HCDEV_ID_ANY)\n+\t\treturn true;\n+\treturn hcdevs[dev_id].info.parent == parent;\n+}\n+\n int16_t\n-rte_hcdev_find_next(int16_t dev_id)\n+rte_hcdev_find_next(int16_t dev_id, int16_t parent)\n {\n \tif (dev_id < 0)\n \t\tdev_id = 0;\n \twhile (dev_id < hcdev_max &&\n-\t\t\thcdevs[dev_id].state == RTE_HCDEV_STATE_UNUSED)\n+\t\t\t(hcdevs[dev_id].state == RTE_HCDEV_STATE_UNUSED ||\n+\t\t\t!hcdev_match_parent(dev_id, parent)))\n \t\tdev_id++;\n \n \tif (dev_id >= hcdev_max)\n@@ -176,6 +185,7 @@ rte_hcdev_allocate(const char *name)\n \tdev->info.name = dev->name;\n \tdev->info.dev_id = dev_id;\n \tdev->info.numa_node = -1;\n+\tdev->info.parent = RTE_HCDEV_ID_NONE;\n \tTAILQ_INIT(&dev->callbacks);\n \n \thcdev_count++;\n@@ -184,6 +194,28 @@ rte_hcdev_allocate(const char *name)\n \treturn dev;\n }\n \n+int16_t\n+rte_hcdev_add_child(const char *name, int16_t parent, uint64_t child_context)\n+{\n+\tstruct rte_hcdev *dev;\n+\n+\tif (!rte_hcdev_is_valid(parent)) {\n+\t\tHCDEV_LOG(ERR, \"add child to invalid parent ID %d\", parent);\n+\t\trte_errno = ENODEV;\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tdev = rte_hcdev_allocate(name);\n+\tif (dev == NULL)\n+\t\treturn -rte_errno;\n+\n+\tdev->info.parent = parent;\n+\tdev->info.context = child_context;\n+\n+\trte_hcdev_complete_new(dev);\n+\treturn dev->info.dev_id;\n+}\n+\n void\n rte_hcdev_complete_new(struct rte_hcdev *dev)\n {\n@@ -197,10 +229,19 @@ rte_hcdev_complete_new(struct rte_hcdev *dev)\n int\n rte_hcdev_release(struct rte_hcdev *dev)\n {\n+\tint16_t dev_id, child;\n+\n \tif (dev == NULL) {\n \t\trte_errno = ENODEV;\n \t\treturn -rte_errno;\n \t}\n+\tdev_id = dev->info.dev_id;\n+\tRTE_HCDEV_FOREACH_CHILD(child, dev_id) {\n+\t\tHCDEV_LOG(ERR, \"cannot release device %d with child %d\",\n+\t\t\t\tdev_id, child);\n+\t\trte_errno = EBUSY;\n+\t\treturn -rte_errno;\n+\t}\n \n \tHCDEV_LOG(DEBUG, \"free device %s (id %d)\",\n \t\t\tdev->info.name, dev->info.dev_id);\ndiff --git a/lib/hcdev/hcdev_driver.h b/lib/hcdev/hcdev_driver.h\nindex 80d11bd612..39f6fc57ab 100644\n--- a/lib/hcdev/hcdev_driver.h\n+++ b/lib/hcdev/hcdev_driver.h\n@@ -31,7 +31,7 @@ typedef int (rte_hcdev_info_get_t)(struct rte_hcdev *dev, struct rte_hcdev_info\n struct rte_hcdev_ops {\n \t/* Get device info. If NULL, info is just copied. */\n \trte_hcdev_info_get_t *dev_info_get;\n-\t/* Close device. */\n+\t/* Close device or child context. */\n \trte_hcdev_close_t *dev_close;\n };\n \ndiff --git a/lib/hcdev/rte_hcdev.h b/lib/hcdev/rte_hcdev.h\nindex 8131e4045a..518020fd2f 100644\n--- a/lib/hcdev/rte_hcdev.h\n+++ b/lib/hcdev/rte_hcdev.h\n@@ -42,8 +42,12 @@ extern \"C\" {\n struct rte_hcdev_info {\n \t/** Unique identifier name. */\n \tconst char *name;\n+\t/** Opaque handler of the device context. */\n+\tuint64_t context;\n \t/** Device ID. */\n \tint16_t dev_id;\n+\t/** ID of the parent device, RTE_HCDEV_ID_NONE if no parent */\n+\tint16_t parent;\n \t/** Total processors available on device. */\n \tuint32_t processor_count;\n \t/** Total memory available on device. */\n@@ -112,6 +116,33 @@ uint16_t rte_hcdev_count_avail(void);\n __rte_experimental\n bool rte_hcdev_is_valid(int16_t dev_id);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Create a virtual device representing a context in the parent device.\n+ *\n+ * @param name\n+ *   Unique string to identify the device.\n+ * @param parent\n+ *   Device ID of the parent.\n+ * @param child_context\n+ *   Opaque context handler.\n+ *\n+ * @return\n+ *   Device ID of the new created child, -rte_errno otherwise:\n+ *   - EINVAL if empty name\n+ *   - ENAMETOOLONG if long name\n+ *   - EEXIST if existing device name\n+ *   - ENODEV if invalid parent\n+ *   - EPERM if secondary process\n+ *   - ENOENT if too many devices\n+ *   - ENOMEM if out of space\n+ */\n+__rte_experimental\n+int16_t rte_hcdev_add_child(const char *name,\n+\t\tint16_t parent, uint64_t child_context);\n+\n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice.\n@@ -120,13 +151,17 @@ bool rte_hcdev_is_valid(int16_t dev_id);\n  *\n  * @param dev_id\n  *   The initial device ID to start the research.\n+ * @param parent\n+ *   The device ID of the parent.\n+ *   RTE_HCDEV_ID_NONE means no parent.\n+ *   RTE_HCDEV_ID_ANY means no or any parent.\n  *\n  * @return\n  *   Next device ID corresponding to a valid and initialized computing device,\n  *   RTE_HCDEV_ID_NONE if there is none.\n  */\n __rte_experimental\n-int16_t rte_hcdev_find_next(int16_t dev_id);\n+int16_t rte_hcdev_find_next(int16_t dev_id, int16_t parent);\n \n /**\n  * @warning\n@@ -138,15 +173,41 @@ int16_t rte_hcdev_find_next(int16_t dev_id);\n  *   The ID of the next possible valid device, usually 0 to iterate all.\n  */\n #define RTE_HCDEV_FOREACH(dev_id) \\\n-\tfor (dev_id = rte_hcdev_find_next(0); \\\n+\tRTE_HCDEV_FOREACH_CHILD(dev_id, RTE_HCDEV_ID_ANY)\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Macro to iterate over all valid computing devices having no parent.\n+ *\n+ * @param dev_id\n+ *   The ID of the next possible valid device, usually 0 to iterate all.\n+ */\n+#define RTE_HCDEV_FOREACH_PARENT(dev_id) \\\n+\tRTE_HCDEV_FOREACH_CHILD(dev_id, RTE_HCDEV_ID_NONE)\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Macro to iterate over all valid children of a computing device parent.\n+ *\n+ * @param dev_id\n+ *   The ID of the next possible valid device, usually 0 to iterate all.\n+ * @param parent\n+ *   The device ID of the parent.\n+ */\n+#define RTE_HCDEV_FOREACH_CHILD(dev_id, parent) \\\n+\tfor (dev_id = rte_hcdev_find_next(0, parent); \\\n \t     dev_id > 0; \\\n-\t     dev_id = rte_hcdev_find_next(dev_id + 1))\n+\t     dev_id = rte_hcdev_find_next(dev_id + 1, parent))\n \n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice.\n  *\n- * Close device.\n+ * Close device or child context.\n  * All resources are released.\n  *\n  * @param dev_id\ndiff --git a/lib/hcdev/version.map b/lib/hcdev/version.map\nindex 24a5a5a7c4..6d1a1ab1c9 100644\n--- a/lib/hcdev/version.map\n+++ b/lib/hcdev/version.map\n@@ -2,6 +2,7 @@ EXPERIMENTAL {\n \tglobal:\n \n \t# added in 21.11\n+\trte_hcdev_add_child;\n \trte_hcdev_callback_register;\n \trte_hcdev_callback_unregister;\n \trte_hcdev_close;\n",
    "prefixes": [
        "RFC",
        "v2",
        "3/7"
    ]
}