get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 50249,
    "url": "http://patches.dpdk.org/api/patches/50249/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190208034407.7865-7-stephen@networkplumber.org/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190208034407.7865-7-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190208034407.7865-7-stephen@networkplumber.org",
    "date": "2019-02-08T03:44:06",
    "name": "[6/7] bus/vmbus: refactor secondary mapping",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c7a63b7c6667d471f6b80030cf41e8762ed0662b",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "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/project/dpdk/patch/20190208034407.7865-7-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 3415,
            "url": "http://patches.dpdk.org/api/series/3415/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=3415",
            "date": "2019-02-08T03:44:00",
            "name": "vmbus/netvsc: fix multi-process support",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/3415/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/50249/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/50249/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 0C07A1B8B2;\n\tFri,  8 Feb 2019 04:44:28 +0100 (CET)",
            "from mail-pf1-f193.google.com (mail-pf1-f193.google.com\n\t[209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 011FA1B87F\n\tfor <dev@dpdk.org>; Fri,  8 Feb 2019 04:44:25 +0100 (CET)",
            "by mail-pf1-f193.google.com with SMTP id j18so1040685pfe.1\n\tfor <dev@dpdk.org>; Thu, 07 Feb 2019 19:44:24 -0800 (PST)",
            "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\ti4sm873275pfj.82.2019.02.07.19.44.22\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 07 Feb 2019 19:44:23 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=/MqK8UDStPd5wVP8rUHvet3+T9Mv+3+WkMrG6pNWrmw=;\n\tb=Gk+7GKfz66pU0wtSjr15KPy1ku0ALl1ltEuhoEoTYhVYyG/5lRyHnu6LAiIIET3K8k\n\tXoNOapN3YMtbHbXQvLwjlLtaOesufSOUQKcOsEKcAaYDdVddufoIufgByYS2y3zLMf+6\n\t8rjM74TJEHupsD9yFLQ9NOEUvXss8L+K0reHY/TW0+yvlrUXlMJbmqUyKXq2s70qxW7I\n\tGQqJvinBDSw939T7Vpvw+Z6NY4lXSoc31pe+OtrQi7heHdDntuBm7dn/5nqrvI7n2IAj\n\tksYg4eeT7f1EFfkRPa8g1DrKW55DOobJnnKfFHwq8j4CtziKohbsrH7SD/Q0Kya/vERk\n\tteJw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=/MqK8UDStPd5wVP8rUHvet3+T9Mv+3+WkMrG6pNWrmw=;\n\tb=O31Y/63cKA228/o1NTt88Cb8Q1eWnybjwnzzGepjZ8y94yH+g0nXncBRX0Lzfaj2pz\n\t08g4hRzJ6zw17qcOC2+ornYX9JHyMkP5aMjA/Epe6DSHQf2ShpZZa4IUNa31RUB0h2jG\n\tTwmzwoC2a1Ky1mTK40cgy3vvJp6T5MjHmloW4kTEpPZLbRgwXQXzTj54Lt93Znrc/nZh\n\t39h/9PAogo6FH2LviVYbb1A/H73gS1ttpbcRdmC/DAADImlCvnNQJ8BxbZQt0T5cl2Ln\n\tQXRsj0tA24OS4XDNSzVBxRvSdEHZ6BsfYS5StgWSUB3l38SJzdbWlrv35rZyaOZrkI+G\n\tABBA==",
        "X-Gm-Message-State": "AHQUAuZj813yeHwQn1i0Y1uj6B6JdndcdwM+XCjOhpRT0/o5wz2YnZcC\n\tov6Ld4ochaXq4WdDcsjISdjgFL+TvDQ=",
        "X-Google-Smtp-Source": "AHgI3IZ5OLhHfa88s9YvWXKbgcFyoYLJQeeG7vAK7gH6fzN0zArmWTpSgkGpR8+w7dyt8Rd76g/3zg==",
        "X-Received": "by 2002:a62:1112:: with SMTP id\n\tz18mr19782175pfi.173.1549597463847; \n\tThu, 07 Feb 2019 19:44:23 -0800 (PST)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org,\n\tStephen Hemminger <sthemmin@microsoft.com>",
        "Date": "Thu,  7 Feb 2019 19:44:06 -0800",
        "Message-Id": "<20190208034407.7865-7-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190208034407.7865-1-stephen@networkplumber.org>",
        "References": "<20190208034407.7865-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 6/7] bus/vmbus: refactor secondary mapping",
        "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": "From: Stephen Hemminger <sthemmin@microsoft.com>\n\nThe secondary mapping function was duplicating the code\nused to search the uio_resource list.\n\nSkip the unwinding since map failure already makes device\nunusable.\n\nSigned-off-by: Stephen Hemminger <sthemmin@microsoft.com>\n---\n drivers/bus/vmbus/vmbus_common_uio.c | 132 ++++++++++++---------------\n 1 file changed, 58 insertions(+), 74 deletions(-)",
    "diff": "diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c\nindex 9947f82ab194..1aa5cb2e4b92 100644\n--- a/drivers/bus/vmbus/vmbus_common_uio.c\n+++ b/drivers/bus/vmbus/vmbus_common_uio.c\n@@ -23,79 +23,82 @@ static struct rte_tailq_elem vmbus_tailq = {\n };\n EAL_REGISTER_TAILQ(vmbus_tailq)\n \n-static int\n-vmbus_uio_map_secondary(struct rte_vmbus_device *dev)\n+struct mapped_vmbus_resource *\n+vmbus_uio_find_resource(const struct rte_vmbus_device *dev)\n {\n-\tint fd, i;\n-\tstruct vmbus_channel *chan;\n \tstruct mapped_vmbus_resource *uio_res;\n-\tstruct mapped_vmbus_res_list *uio_res_list\n-\t\t= RTE_TAILQ_CAST(vmbus_tailq.head, mapped_vmbus_res_list);\n+\tstruct mapped_vmbus_res_list *uio_res_list =\n+\t\t\tRTE_TAILQ_CAST(vmbus_tailq.head, mapped_vmbus_res_list);\n+\n+\tif (dev == NULL)\n+\t\treturn NULL;\n \n \tTAILQ_FOREACH(uio_res, uio_res_list, next) {\n+\t\tif (rte_uuid_compare(uio_res->id, dev->device_id) == 0)\n+\t\t\treturn uio_res;\n+\t}\n+\treturn NULL;\n+}\n \n-\t\t/* skip this element if it doesn't match our UUID */\n-\t\tif (rte_uuid_compare(uio_res->id, dev->device_id) != 0)\n-\t\t\tcontinue;\n+static int\n+vmbus_uio_map_secondary(struct rte_vmbus_device *dev)\n+{\n+\tstruct mapped_vmbus_resource *uio_res;\n+\tstruct vmbus_channel *chan;\n+\tint fd, i;\n \n-\t\t/* open /dev/uioX */\n-\t\tfd = open(uio_res->path, O_RDWR);\n-\t\tif (fd < 0) {\n-\t\t\tVMBUS_LOG(ERR, \"Cannot open %s: %s\",\n-\t\t\t\t  uio_res->path, strerror(errno));\n-\t\t\treturn -1;\n-\t\t}\n+\tuio_res = vmbus_uio_find_resource(dev);\n+\tif (!uio_res) {\n+\t\tVMBUS_LOG(ERR,  \"Cannot find resource for device\");\n+\t\treturn -1;\n+\t}\n \n-\t\tfor (i = 0; i != uio_res->nb_maps; i++) {\n-\t\t\tvoid *mapaddr;\n-\t\t\toff_t offset = i * PAGE_SIZE;\n+\t/* open /dev/uioX */\n+\tfd = open(uio_res->path, O_RDWR);\n+\tif (fd < 0) {\n+\t\tVMBUS_LOG(ERR, \"Cannot open %s: %s\",\n+\t\t\t  uio_res->path, strerror(errno));\n+\t\treturn -1;\n+\t}\n \n-\t\t\tmapaddr = vmbus_map_resource(uio_res->maps[i].addr,\n-\t\t\t\t\t\t     fd, offset,\n-\t\t\t\t\t\t     uio_res->maps[i].size, 0);\n+\tfor (i = 0; i != uio_res->nb_maps; i++) {\n+\t\tvoid *mapaddr;\n+\t\toff_t offset = i * PAGE_SIZE;\n \n-\t\t\tif (mapaddr == uio_res->maps[i].addr)\n-\t\t\t\tcontinue;\n+\t\tmapaddr = vmbus_map_resource(uio_res->maps[i].addr,\n+\t\t\t\t\t     fd, offset,\n+\t\t\t\t\t     uio_res->maps[i].size, 0);\n \n-\t\t\tVMBUS_LOG(ERR,\n-\t\t\t\t  \"Cannot mmap device resource file %s to address: %p\",\n-\t\t\t\t  uio_res->path, uio_res->maps[i].addr);\n+\t\tif (mapaddr == uio_res->maps[i].addr)\n+\t\t\tcontinue;\t/* successful map */\n \n-\t\t\tif (mapaddr != MAP_FAILED)\n-\t\t\t\t/* unmap addr wrongly mapped */\n-\t\t\t\tvmbus_unmap_resource(mapaddr,\n-\t\t\t\t\t\t     (size_t)uio_res->maps[i].size);\n+\t\tif (mapaddr == MAP_FAILED)\n+\t\t\tVMBUS_LOG(ERR,\n+\t\t\t\t  \"mmap resource %d in secondary failed\", i);\n+\t\telse\n+\t\t\tVMBUS_LOG(ERR,\n+\t\t\t\t  \"mmap resource %d address mismatch\", i);\n \n-\t\t\t/* unmap addrs correctly mapped */\n-\t\t\twhile (--i >= 0)\n-\t\t\t\tvmbus_unmap_resource(uio_res->maps[i].addr,\n-\t\t\t\t\t\t     (size_t)uio_res->maps[i].size);\n+\t\tclose(fd);\n+\t\treturn -1;\n+\t}\n \n-\t\t\tclose(fd);\n-\t\t\treturn -1;\n-\t\t}\n+\t/* fd is not needed in slave process, close it */\n+\tclose(fd);\n \n-\t\t/* fd is not needed in slave process, close it */\n-\t\tclose(fd);\n+\tdev->primary = uio_res->primary;\n+\tif (!dev->primary) {\n+\t\tVMBUS_LOG(ERR, \"missing primary channel\");\n+\t\treturn -1;\n+\t}\n \n-\t\tdev->primary = uio_res->primary;\n-\t\tif (!dev->primary) {\n-\t\t\tVMBUS_LOG(ERR, \"missing primary channel\");\n+\tSTAILQ_FOREACH(chan, &dev->primary->subchannel_list, next) {\n+\t\tif (vmbus_uio_map_secondary_subchan(dev, chan) != 0) {\n+\t\t\tVMBUS_LOG(ERR, \"cannot map secondary subchan\");\n \t\t\treturn -1;\n \t\t}\n-\n-\t\tSTAILQ_FOREACH(chan, &dev->primary->subchannel_list, next) {\n-\t\t\tif (vmbus_uio_map_secondary_subchan(dev, chan) != 0) {\n-\t\t\t\tVMBUS_LOG(ERR, \"cannot map secondary subchan\");\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t}\n-\n-\t\treturn 0;\n \t}\n-\n-\tVMBUS_LOG(ERR,  \"Cannot find resource for device\");\n-\treturn 1;\n+\treturn 0;\n }\n \n static int\n@@ -136,25 +139,6 @@ vmbus_uio_map_primary(struct rte_vmbus_device *dev)\n \treturn -1;\n }\n \n-\n-struct mapped_vmbus_resource *\n-vmbus_uio_find_resource(const struct rte_vmbus_device *dev)\n-{\n-\tstruct mapped_vmbus_resource *uio_res;\n-\tstruct mapped_vmbus_res_list *uio_res_list =\n-\t\t\tRTE_TAILQ_CAST(vmbus_tailq.head, mapped_vmbus_res_list);\n-\n-\tif (dev == NULL)\n-\t\treturn NULL;\n-\n-\tTAILQ_FOREACH(uio_res, uio_res_list, next) {\n-\t\t/* skip this element if it doesn't match our VMBUS address */\n-\t\tif (rte_uuid_compare(uio_res->id, dev->device_id) == 0)\n-\t\t\treturn uio_res;\n-\t}\n-\treturn NULL;\n-}\n-\n /* map the VMBUS resource of a VMBUS device in virtual memory */\n int\n vmbus_uio_map_resource(struct rte_vmbus_device *dev)\n",
    "prefixes": [
        "6/7"
    ]
}