get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 964074,
    "url": "http://patchwork.ozlabs.org/api/patches/964074/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180830185352.3369-13-logang@deltatee.com/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20180830185352.3369-13-logang@deltatee.com>",
    "list_archive_url": null,
    "date": "2018-08-30T18:53:51",
    "name": "[v5,12/13] nvmet: Introduce helper functions to allocate and free request SGLs",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "01a5f91f7e691da45bfc88c0659e965c25988773",
    "submitter": {
        "id": 70191,
        "url": "http://patchwork.ozlabs.org/api/people/70191/?format=api",
        "name": "Logan Gunthorpe",
        "email": "logang@deltatee.com"
    },
    "delegate": {
        "id": 6763,
        "url": "http://patchwork.ozlabs.org/api/users/6763/?format=api",
        "username": "bhelgaas",
        "first_name": "Bjorn",
        "last_name": "Helgaas",
        "email": "bhelgaas@google.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180830185352.3369-13-logang@deltatee.com/mbox/",
    "series": [
        {
            "id": 63352,
            "url": "http://patchwork.ozlabs.org/api/series/63352/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=63352",
            "date": "2018-08-30T18:53:41",
            "name": "Copy Offload in NVMe Fabrics with P2P PCI Memory",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/63352/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/964074/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/964074/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-pci-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=deltatee.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 421Wrc1CLXz9s1x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 31 Aug 2018 04:54:56 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1727838AbeH3W5m (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 30 Aug 2018 18:57:42 -0400",
            "from ale.deltatee.com ([207.54.116.67]:40086 \"EHLO\n\tale.deltatee.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1727406AbeH3W5l (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tThu, 30 Aug 2018 18:57:41 -0400",
            "from cgy1-donard.priv.deltatee.com ([172.16.1.31])\n\tby ale.deltatee.com with esmtps\n\t(TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)\n\t(envelope-from <gunthorp@deltatee.com>)\n\tid 1fvS4u-0006Or-GN; Thu, 30 Aug 2018 12:54:06 -0600",
            "from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim\n\t4.89) (envelope-from <gunthorp@deltatee.com>)\n\tid 1fvS4p-0000to-AP; Thu, 30 Aug 2018 12:53:55 -0600"
        ],
        "From": "Logan Gunthorpe <logang@deltatee.com>",
        "To": "linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n\tlinux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org,\n\tlinux-nvdimm@lists.01.org, linux-block@vger.kernel.org",
        "Cc": "Stephen Bates <sbates@raithlin.com>, Christoph Hellwig <hch@lst.de>,\n\tKeith Busch <keith.busch@intel.com>, Sagi Grimberg <sagi@grimberg.me>,\n\tBjorn Helgaas <bhelgaas@google.com>, Jason Gunthorpe <jgg@mellanox.com>, \n\tMax Gurtovoy <maxg@mellanox.com>,\n\tDan Williams <dan.j.williams@intel.com>, =?utf-8?b?SsOpcsO0bWUgR2xp?=\n\t=?utf-8?q?sse?= <jglisse@redhat.com>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>, Alex Williamson\n\t<alex.williamson@redhat.com>, =?utf-8?q?Christian_K=C3=B6nig?=\n\t<christian.koenig@amd.com>, Logan Gunthorpe <logang@deltatee.com>",
        "Date": "Thu, 30 Aug 2018 12:53:51 -0600",
        "Message-Id": "<20180830185352.3369-13-logang@deltatee.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20180830185352.3369-1-logang@deltatee.com>",
        "References": "<20180830185352.3369-1-logang@deltatee.com>",
        "X-SA-Exim-Connect-IP": "172.16.1.31",
        "X-SA-Exim-Rcpt-To": "linux-nvme@lists.infradead.org, linux-nvdimm@lists.01.org,\n\tlinux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n\tlinux-rdma@vger.kernel.org, linux-block@vger.kernel.org,\n\tsbates@raithlin.com, hch@lst.de, sagi@grimberg.me,\n\tbhelgaas@google.com, jgg@mellanox.com, maxg@mellanox.com,\n\tkeith.busch@intel.com, dan.j.williams@intel.com,\n\tbenh@kernel.crashing.org, jglisse@redhat.com,\n\talex.williamson@redhat.com, christian.koenig@amd.com,\n\tlogang@deltatee.com",
        "X-SA-Exim-Mail-From": "gunthorp@deltatee.com",
        "X-Spam-Checker-Version": "SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-8.5 required=5.0 tests=ALL_TRUSTED,BAYES_00,\n\tGREYLIST_ISWHITE,MYRULES_FREE,MYRULES_NO_TEXT autolearn=ham\n\tautolearn_force=no version=3.4.1",
        "Subject": "[PATCH v5 12/13] nvmet: Introduce helper functions to allocate and\n\tfree request SGLs",
        "X-SA-Exim-Version": "4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000)",
        "X-SA-Exim-Scanned": "Yes (on ale.deltatee.com)",
        "Sender": "linux-pci-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-pci.vger.kernel.org>",
        "X-Mailing-List": "linux-pci@vger.kernel.org"
    },
    "content": "Add helpers to allocate and free the SGL in a struct nvmet_req:\n\nint nvmet_req_alloc_sgl(struct nvmet_req *req, struct nvmet_sq *sq)\nvoid nvmet_req_free_sgl(struct nvmet_req *req)\n\nThis will be expanded in a future patch to implement peer-to-peer\nmemory DMAs and should be common with all target drivers. The presently\nunused 'sq' argument in the alloc function will be necessary to\ndecide whether to use peer-to-peer memory and obtain the correct\nprovider to allocate the memory.\n\nThe new helpers are used in nvmet-rdma. Seeing we use req.transfer_len\nas the length of the SGL it is set earlier and cleared on any error.\nIt also seems to be unnecessary to accumulate the length as the map_sgl\nfunctions should only ever be called once per request.\n\nSigned-off-by: Logan Gunthorpe <logang@deltatee.com>\nCc: Christoph Hellwig <hch@lst.de>\nCc: Sagi Grimberg <sagi@grimberg.me>\n---\n drivers/nvme/target/core.c  | 18 ++++++++++++++++++\n drivers/nvme/target/nvmet.h |  2 ++\n drivers/nvme/target/rdma.c  | 20 ++++++++++++--------\n 3 files changed, 32 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c\nindex ebf3e7a6c49e..6a1c8d5f552b 100644\n--- a/drivers/nvme/target/core.c\n+++ b/drivers/nvme/target/core.c\n@@ -725,6 +725,24 @@ void nvmet_req_execute(struct nvmet_req *req)\n }\n EXPORT_SYMBOL_GPL(nvmet_req_execute);\n \n+int nvmet_req_alloc_sgl(struct nvmet_req *req, struct nvmet_sq *sq)\n+{\n+\treq->sg = sgl_alloc(req->transfer_len, GFP_KERNEL, &req->sg_cnt);\n+\tif (!req->sg)\n+\t\treturn -ENOMEM;\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(nvmet_req_alloc_sgl);\n+\n+void nvmet_req_free_sgl(struct nvmet_req *req)\n+{\n+\tsgl_free(req->sg);\n+\treq->sg = NULL;\n+\treq->sg_cnt = 0;\n+}\n+EXPORT_SYMBOL_GPL(nvmet_req_free_sgl);\n+\n static inline bool nvmet_cc_en(u32 cc)\n {\n \treturn (cc >> NVME_CC_EN_SHIFT) & 0x1;\ndiff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h\nindex ec9af4ee03b6..7d6cb61021e4 100644\n--- a/drivers/nvme/target/nvmet.h\n+++ b/drivers/nvme/target/nvmet.h\n@@ -336,6 +336,8 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,\n void nvmet_req_uninit(struct nvmet_req *req);\n void nvmet_req_execute(struct nvmet_req *req);\n void nvmet_req_complete(struct nvmet_req *req, u16 status);\n+int nvmet_req_alloc_sgl(struct nvmet_req *req, struct nvmet_sq *sq);\n+void nvmet_req_free_sgl(struct nvmet_req *req);\n \n void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,\n \t\tu16 size);\ndiff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c\nindex 3533e918ea37..e148dee72ba5 100644\n--- a/drivers/nvme/target/rdma.c\n+++ b/drivers/nvme/target/rdma.c\n@@ -489,7 +489,7 @@ static void nvmet_rdma_release_rsp(struct nvmet_rdma_rsp *rsp)\n \t}\n \n \tif (rsp->req.sg != rsp->cmd->inline_sg)\n-\t\tsgl_free(rsp->req.sg);\n+\t\tnvmet_req_free_sgl(&rsp->req);\n \n \tif (unlikely(!list_empty_careful(&queue->rsp_wr_wait_list)))\n \t\tnvmet_rdma_process_wr_wait_list(queue);\n@@ -638,24 +638,24 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,\n {\n \tstruct rdma_cm_id *cm_id = rsp->queue->cm_id;\n \tu64 addr = le64_to_cpu(sgl->addr);\n-\tu32 len = get_unaligned_le24(sgl->length);\n \tu32 key = get_unaligned_le32(sgl->key);\n \tint ret;\n \n+\trsp->req.transfer_len = get_unaligned_le24(sgl->length);\n+\n \t/* no data command? */\n-\tif (!len)\n+\tif (!rsp->req.transfer_len)\n \t\treturn 0;\n \n-\trsp->req.sg = sgl_alloc(len, GFP_KERNEL, &rsp->req.sg_cnt);\n-\tif (!rsp->req.sg)\n-\t\treturn NVME_SC_INTERNAL;\n+\tret = nvmet_req_alloc_sgl(&rsp->req, &rsp->queue->nvme_sq);\n+\tif (ret < 0)\n+\t\tgoto error_out;\n \n \tret = rdma_rw_ctx_init(&rsp->rw, cm_id->qp, cm_id->port_num,\n \t\t\trsp->req.sg, rsp->req.sg_cnt, 0, addr, key,\n \t\t\tnvmet_data_dir(&rsp->req));\n \tif (ret < 0)\n-\t\treturn NVME_SC_INTERNAL;\n-\trsp->req.transfer_len += len;\n+\t\tgoto error_out;\n \trsp->n_rdma += ret;\n \n \tif (invalidate) {\n@@ -664,6 +664,10 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,\n \t}\n \n \treturn 0;\n+\n+error_out:\n+\trsp->req.transfer_len = 0;\n+\treturn NVME_SC_INTERNAL;\n }\n \n static u16 nvmet_rdma_map_sgl(struct nvmet_rdma_rsp *rsp)\n",
    "prefixes": [
        "v5",
        "12/13"
    ]
}