get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 55784,
    "url": "http://patches.dpdk.org/api/patches/55784/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190701155600.43695-6-bruce.richardson@intel.com/",
    "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": "<20190701155600.43695-6-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190701155600.43695-6-bruce.richardson@intel.com",
    "date": "2019-07-01T15:55:56",
    "name": "[v4,5/9] raw/ioat: create device on probe and destroy on release",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b18852e292d9e12fb0ed3affe2eb696834894a74",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@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/project/dpdk/patch/20190701155600.43695-6-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 5257,
            "url": "http://patches.dpdk.org/api/series/5257/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5257",
            "date": "2019-07-01T15:55:51",
            "name": "raw/ioat: driver for Intel QuickData Technology",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/5257/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/55784/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/55784/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 449881BA9A;\n\tMon,  1 Jul 2019 17:56:34 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 7E5611B9F9\n\tfor <dev@dpdk.org>; Mon,  1 Jul 2019 17:56:25 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Jul 2019 08:56:22 -0700",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.2])\n\tby fmsmga004.fm.intel.com with ESMTP; 01 Jul 2019 08:56:19 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.63,439,1557212400\"; d=\"scan'208\";a=\"186524043\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, jerinj@marvell.com, jiayu.hu@intel.com,\n\tBruce Richardson <bruce.richardson@intel.com>,\n\tHarry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Mon,  1 Jul 2019 16:55:56 +0100",
        "Message-Id": "<20190701155600.43695-6-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190701155600.43695-1-bruce.richardson@intel.com>",
        "References": "<20190530212525.40370-1-bruce.richardson@intel.com>\n\t<20190701155600.43695-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 5/9] raw/ioat: create device on probe and\n\tdestroy on release",
        "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": "Add the create/destroy driver functions so that we can actually allocate\na rawdev and destroy it when done. No rawdev API functions are actually\nimplemented at this point.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nTested-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\nV4:\n* changed error code for pmd allocation to ENOMEM instead of EINVAL\n* Use contiguous memory for device structure allocation\n---\n doc/guides/rawdevs/ioat_rawdev.rst |  11 +++\n drivers/raw/ioat/ioat_rawdev.c     | 112 ++++++++++++++++++++++++++++-\n drivers/raw/ioat/rte_ioat_rawdev.h |  24 +++++++\n 3 files changed, 144 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/rawdevs/ioat_rawdev.rst b/doc/guides/rawdevs/ioat_rawdev.rst\nindex 1a4b0e03e..4b7fe8a8f 100644\n--- a/doc/guides/rawdevs/ioat_rawdev.rst\n+++ b/doc/guides/rawdevs/ioat_rawdev.rst\n@@ -72,3 +72,14 @@ them to a suitable DPDK-supported kernel driver. When querying the status\n of the devices, they will appear under the category of \"Misc (rawdev)\n devices\", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be\n used to see the state of those devices alone.\n+\n+Device Probing and Initialization\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Once bound to a suitable kernel device driver, the HW devices will be found\n+as part of the PCI scan done at application initialization time. No vdev\n+parameters need to be passed to create or initialize the device.\n+\n+Once probed successfully, the device will appear as a ``rawdev``, that is a\n+\"raw device type\" inside DPDK, and can be accessed using APIs from the\n+``rte_rawdev`` library.\ndiff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c\nindex 07f6d8dfa..86b5b2a77 100644\n--- a/drivers/raw/ioat/ioat_rawdev.c\n+++ b/drivers/raw/ioat/ioat_rawdev.c\n@@ -2,6 +2,7 @@\n  * Copyright(c) 2019 Intel Corporation\n  */\n \n+#include <rte_cycles.h>\n #include <rte_bus_pci.h>\n #include <rte_rawdev_pmd.h>\n \n@@ -36,15 +37,120 @@ static struct rte_pci_driver ioat_pmd_drv;\n static int\n ioat_rawdev_create(const char *name, struct rte_pci_device *dev)\n {\n-\tRTE_SET_USED(name);\n-\tRTE_SET_USED(dev);\n+\tstatic const struct rte_rawdev_ops ioat_rawdev_ops = {\n+\t};\n+\n+\tstruct rte_rawdev *rawdev = NULL;\n+\tstruct rte_ioat_rawdev *ioat = NULL;\n+\tconst struct rte_memzone *mz = NULL;\n+\tchar mz_name[RTE_MEMZONE_NAMESIZE];\n+\tint ret = 0;\n+\tint retry = 0;\n+\n+\tif (!name) {\n+\t\tIOAT_PMD_ERR(\"Invalid name of the device!\");\n+\t\tret = -EINVAL;\n+\t\tgoto cleanup;\n+\t}\n+\n+\t/* Allocate device structure */\n+\trawdev = rte_rawdev_pmd_allocate(name, sizeof(struct rte_ioat_rawdev),\n+\t\t\t\t\t dev->device.numa_node);\n+\tif (rawdev == NULL) {\n+\t\tIOAT_PMD_ERR(\"Unable to allocate raw device\");\n+\t\tret = -ENOMEM;\n+\t\tgoto cleanup;\n+\t}\n+\n+\tsnprintf(mz_name, sizeof(mz_name), \"rawdev%u_private\", rawdev->dev_id);\n+\tmz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),\n+\t\t\tdev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);\n+\tif (mz == NULL) {\n+\t\tIOAT_PMD_ERR(\"Unable to reserve memzone for private data\\n\");\n+\t\tret = -ENOMEM;\n+\t\tgoto cleanup;\n+\t}\n+\n+\trawdev->dev_private = mz->addr;\n+\trawdev->dev_ops = &ioat_rawdev_ops;\n+\trawdev->device = &dev->device;\n+\trawdev->driver_name = dev->device.driver->name;\n+\n+\tioat = rawdev->dev_private;\n+\tioat->rawdev = rawdev;\n+\tioat->mz = mz;\n+\tioat->regs = dev->mem_resource[0].addr;\n+\tioat->ring_size = 0;\n+\tioat->desc_ring = NULL;\n+\tioat->status_addr = ioat->mz->iova +\n+\t\t\toffsetof(struct rte_ioat_rawdev, status);\n+\n+\t/* do device initialization - reset and set error behaviour */\n+\tif (ioat->regs->chancnt != 1)\n+\t\tIOAT_PMD_ERR(\"%s: Channel count == %d\\n\", __func__,\n+\t\t\t\tioat->regs->chancnt);\n+\n+\tif (ioat->regs->chanctrl & 0x100) { /* locked by someone else */\n+\t\tIOAT_PMD_WARN(\"%s: Channel appears locked\\n\", __func__);\n+\t\tioat->regs->chanctrl = 0;\n+\t}\n+\n+\tioat->regs->chancmd = RTE_IOAT_CHANCMD_SUSPEND;\n+\trte_delay_ms(1);\n+\tioat->regs->chancmd = RTE_IOAT_CHANCMD_RESET;\n+\trte_delay_ms(1);\n+\twhile (ioat->regs->chancmd & RTE_IOAT_CHANCMD_RESET) {\n+\t\tioat->regs->chainaddr = 0;\n+\t\trte_delay_ms(1);\n+\t\tif (++retry >= 200) {\n+\t\t\tIOAT_PMD_ERR(\"%s: cannot reset device. CHANCMD=0x%\"PRIx8\", CHANSTS=0x%\"PRIx64\", CHANERR=0x%\"PRIx32\"\\n\",\n+\t\t\t\t\t__func__,\n+\t\t\t\t\tioat->regs->chancmd,\n+\t\t\t\t\tioat->regs->chansts,\n+\t\t\t\t\tioat->regs->chanerr);\n+\t\t\tret = -EIO;\n+\t\t}\n+\t}\n+\tioat->regs->chanctrl = RTE_IOAT_CHANCTRL_ANY_ERR_ABORT_EN |\n+\t\t\tRTE_IOAT_CHANCTRL_ERR_COMPLETION_EN;\n+\n \treturn 0;\n+\n+cleanup:\n+\tif (rawdev)\n+\t\trte_rawdev_pmd_release(rawdev);\n+\n+\treturn ret;\n }\n \n static int\n ioat_rawdev_destroy(const char *name)\n {\n-\tRTE_SET_USED(name);\n+\tint ret;\n+\tstruct rte_rawdev *rdev;\n+\n+\tif (!name) {\n+\t\tIOAT_PMD_ERR(\"Invalid device name\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\trdev = rte_rawdev_pmd_get_named_dev(name);\n+\tif (!rdev) {\n+\t\tIOAT_PMD_ERR(\"Invalid device name (%s)\", name);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rdev->dev_private != NULL) {\n+\t\tstruct rte_ioat_rawdev *ioat = rdev->dev_private;\n+\t\trdev->dev_private = NULL;\n+\t\trte_memzone_free(ioat->mz);\n+\t}\n+\n+\t/* rte_rawdev_close is called by pmd_release */\n+\tret = rte_rawdev_pmd_release(rdev);\n+\tif (ret)\n+\t\tIOAT_PMD_DEBUG(\"Device cleanup failed\");\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h\nindex e77406403..f83d26ef0 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev.h\n@@ -14,6 +14,10 @@\n  * @b EXPERIMENTAL: these structures and APIs may change without prior notice\n  */\n \n+#include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_ioat_spec.h>\n+\n /** Name of the device driver */\n #define IOAT_PMD_RAWDEV_NAME rawdev_ioat\n /** String reported as the device driver name by rte_rawdev_info_get() */\n@@ -21,4 +25,24 @@\n /** Name used to adjust the log level for this driver */\n #define IOAT_PMD_LOG_NAME \"rawdev.ioat\"\n \n+/**\n+ * @internal\n+ * Structure representing a device instance\n+ */\n+struct rte_ioat_rawdev {\n+\tstruct rte_rawdev *rawdev;\n+\tconst struct rte_memzone *mz;\n+\tconst struct rte_memzone *desc_mz;\n+\n+\tvolatile struct rte_ioat_registers *regs;\n+\tphys_addr_t status_addr;\n+\tphys_addr_t ring_addr;\n+\n+\tunsigned short ring_size;\n+\tstruct rte_ioat_generic_hw_desc *desc_ring;\n+\n+\t/* to report completions, the device will write status back here */\n+\tvolatile uint64_t status __rte_cache_aligned;\n+};\n+\n #endif\n",
    "prefixes": [
        "v4",
        "5/9"
    ]
}