get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 53933,
    "url": "http://patches.dpdk.org/api/patches/53933/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190530212525.40370-7-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": "<20190530212525.40370-7-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190530212525.40370-7-bruce.richardson@intel.com",
    "date": "2019-05-30T21:25:23",
    "name": "[6/8] raw/ioat: add configure, start and stop functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "82c298e4d93325f702cce0a5dfeac3b36c115684",
    "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/20190530212525.40370-7-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 4831,
            "url": "http://patches.dpdk.org/api/series/4831/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4831",
            "date": "2019-05-30T21:25:17",
            "name": "raw/ioat: driver for Intel QuickData Technology",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4831/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53933/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53933/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 DE4541B96E;\n\tThu, 30 May 2019 23:26:03 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id B0DF84F91\n\tfor <dev@dpdk.org>; Thu, 30 May 2019 23:25:52 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 May 2019 14:25:51 -0700",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.2])\n\tby orsmga001.jf.intel.com with ESMTP; 30 May 2019 14:25:51 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu, 30 May 2019 22:25:23 +0100",
        "Message-Id": "<20190530212525.40370-7-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190530212525.40370-1-bruce.richardson@intel.com>",
        "References": "<20190530212525.40370-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 6/8] raw/ioat: add configure,\n\tstart and stop functions",
        "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": "Allow initializing a driver instance.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test/test_ioat_rawdev.c        | 35 +++++++++++++-\n doc/guides/rawdevs/ioat_rawdev.rst | 32 +++++++++++++\n drivers/raw/ioat/ioat_rawdev.c     | 75 ++++++++++++++++++++++++++++++\n drivers/raw/ioat/rte_ioat_rawdev.h | 14 ++++++\n 4 files changed, 155 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_ioat_rawdev.c b/app/test/test_ioat_rawdev.c\nindex ac1389f6e..36e97347c 100644\n--- a/app/test/test_ioat_rawdev.c\n+++ b/app/test/test_ioat_rawdev.c\n@@ -18,6 +18,39 @@ test_ioat_rawdev(void) { return TEST_SKIPPED; }\n #include <rte_rawdev.h>\n #include <rte_ioat_rawdev.h>\n \n+static int\n+run_ioat_tests(int dev_id)\n+{\n+#define IOAT_TEST_RINGSIZE 512\n+\tstruct rte_ioat_rawdev_config p = { .ring_size = -1 };\n+\tstruct rte_rawdev_info info = { .dev_private = &p };\n+\n+\trte_rawdev_info_get(dev_id, &info);\n+\tif (p.ring_size != 0) {\n+\t\tprintf(\"Error, initial ring size is non-zero (%d)\\n\",\n+\t\t\t\t(int)p.ring_size);\n+\t\treturn -1;\n+\t}\n+\n+\tp.ring_size = IOAT_TEST_RINGSIZE;\n+\tif (rte_rawdev_configure(dev_id, &info) != 0) {\n+\t\tprintf(\"Error with rte_rawdev_configure()\\n\");\n+\t\treturn -1;\n+\t}\n+\trte_rawdev_info_get(dev_id, &info);\n+\tif (p.ring_size != IOAT_TEST_RINGSIZE) {\n+\t\tprintf(\"Error, ring size is not %d (%d)\\n\",\n+\t\t\t\tIOAT_TEST_RINGSIZE, (int)p.ring_size);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_rawdev_start(dev_id) != 0) {\n+\t\tprintf(\"Error with rte_rawdev_start()\\n\");\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n static int\n test_ioat_rawdev(void)\n {\n@@ -37,7 +70,7 @@ test_ioat_rawdev(void)\n \t\treturn TEST_SKIPPED;\n \t}\n \n-\treturn 0;\n+\treturn run_ioat_tests(i);\n }\n \n #endif /* RTE_LIBRTE_PMD_IOAT_RAWDEV */\ndiff --git a/doc/guides/rawdevs/ioat_rawdev.rst b/doc/guides/rawdevs/ioat_rawdev.rst\nindex b68cdffc3..b3fe79033 100644\n--- a/doc/guides/rawdevs/ioat_rawdev.rst\n+++ b/doc/guides/rawdevs/ioat_rawdev.rst\n@@ -79,3 +79,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either\n be NULL, or else be set to point to a structure of type\n ``rte_ioat_rawdev_config``, in which case the size of the configured device\n input ring will be returned in that structure.\n+\n+Device Configuration\n+~~~~~~~~~~~~~~~~~~~~~\n+\n+Configuring an IOAT rawdev device is done using the\n+``rte_rawdev_configure()`` API, which takes the same structure parameters\n+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main\n+difference is that, because the parameter is used as input rather than\n+output, the ``dev_private`` structure element cannot be NULL, and must\n+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring\n+size to be used by the device. The ring size must be a power of two,\n+between 64 and 4096.\n+\n+The following code shows how the device is configured in\n+``test_ioat_rawdev.c``:\n+\n+.. code-block:: C\n+\n+   #define IOAT_TEST_RINGSIZE 512\n+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };\n+        struct rte_rawdev_info info = { .dev_private = &p };\n+\n+        /* ... */\n+\n+        p.ring_size = IOAT_TEST_RINGSIZE;\n+        if (rte_rawdev_configure(dev_id, &info) != 0) {\n+                printf(\"Error with rte_rawdev_configure()\\n\");\n+                return -1;\n+        }\n+\n+Once configured, the device can then be made ready for use by calling the\n+``rte_rawdev_start()`` API.\ndiff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c\nindex 90bed2810..b4b70a1e6 100644\n--- a/drivers/raw/ioat/ioat_rawdev.c\n+++ b/drivers/raw/ioat/ioat_rawdev.c\n@@ -24,6 +24,78 @@ static struct rte_pci_driver ioat_pmd_drv;\n #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)\n #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)\n \n+#define DESC_SZ sizeof(struct rte_ioat_desc)\n+#define COMPLETION_SZ sizeof(__m128i)\n+\n+static int\n+ioat_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t config)\n+{\n+\tstruct rte_ioat_rawdev_config *params = config;\n+\tstruct rte_ioat_rawdev *ioat = dev->dev_private;\n+\tunsigned short i;\n+\n+\tif (dev->started)\n+\t\treturn -EBUSY;\n+\n+\tif (params == NULL)\n+\t\treturn -EINVAL;\n+\n+\tif (params->ring_size > 4096 || params->ring_size < 64 ||\n+\t\t\t!rte_is_power_of_2(params->ring_size))\n+\t\treturn -EINVAL;\n+\n+\tioat->ring_size = params->ring_size;\n+\tif (ioat->desc_ring != NULL) {\n+\t\trte_free(ioat->desc_ring);\n+\t\tioat->desc_ring = NULL;\n+\t}\n+\n+\t/* allocate one block of memory for both descriptors\n+\t * and completion handles.\n+\t */\n+\tioat->desc_ring = rte_zmalloc_socket(NULL,\n+\t\t\t(DESC_SZ + COMPLETION_SZ) * ioat->ring_size,\n+\t\t\t0, /* alignment, default to 64Byte */\n+\t\t\tdev->device->numa_node);\n+\tif (ioat->desc_ring == NULL)\n+\t\treturn -ENOMEM;\n+\tioat->hdls = (void *)&ioat->desc_ring[ioat->ring_size];\n+\n+\tioat->ring_addr = rte_malloc_virt2iova(ioat->desc_ring);\n+\n+\t/* configure descriptor ring - each one points to next */\n+\tfor (i = 0; i < ioat->ring_size; i++) {\n+\t\tioat->desc_ring[i].next_desc_addr = ioat->ring_addr +\n+\t\t\t\t(((i + 1) % ioat->ring_size) * DESC_SZ);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+ioat_dev_start(struct rte_rawdev *dev)\n+{\n+\tstruct rte_ioat_rawdev *ioat = dev->dev_private;\n+\n+\tif (ioat->ring_size == 0 || ioat->desc_ring == NULL)\n+\t\treturn -EBUSY;\n+\n+\t/* inform hardware of where the descriptor ring is */\n+\tioat->regs->chainaddr = ioat->ring_addr;\n+\t/* inform hardware of where to write the status/completions */\n+\tioat->regs->chancmp = ioat->status_addr;\n+\n+\t/* prime the status register to be set to the last element */\n+\tioat->status =  ioat->ring_addr + ((ioat->ring_size - 1) * DESC_SZ);\n+\treturn 0;\n+}\n+\n+static void\n+ioat_dev_stop(struct rte_rawdev *dev)\n+{\n+\tRTE_SET_USED(dev);\n+}\n+\n static void\n ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)\n {\n@@ -38,6 +110,9 @@ static int\n ioat_rawdev_create(const char *name, struct rte_pci_device *dev)\n {\n \tstatic const struct rte_rawdev_ops ioat_rawdev_ops = {\n+\t\t\t.dev_configure = ioat_dev_configure,\n+\t\t\t.dev_start = ioat_dev_start,\n+\t\t\t.dev_stop = ioat_dev_stop,\n \t\t\t.dev_info_get = ioat_dev_info_get,\n \t};\n \ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h\nindex 7e0d72ca3..7eab216c8 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev.h\n@@ -47,9 +47,23 @@ struct rte_ioat_rawdev {\n \n \tunsigned short ring_size;\n \tstruct rte_ioat_desc *desc_ring;\n+\t__m128i *hdls; /* completion handles for returning to user */\n \n \t/* to report completions, the device will write status back here */\n \tvolatile uint64_t status __rte_cache_aligned;\n };\n \n+/**\n+ * @internal\n+ * Structure representing a descriptor for a copy operation\n+ */\n+struct rte_ioat_desc {\n+\tuint32_t xfer_size __rte_cache_aligned;\n+\tuint32_t desc_control;\n+\tphys_addr_t src_addr; /* 64 bits */\n+\tphys_addr_t dest_addr; /* 64 bits */\n+\tphys_addr_t next_desc_addr; /* 64 bits */\n+\tuint64_t op_type_specific[4];\n+};\n+\n #endif\n",
    "prefixes": [
        "6/8"
    ]
}