get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97475,
    "url": "http://patches.dpdk.org/api/patches/97475/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210827172048.558704-6-kevin.laatz@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": "<20210827172048.558704-6-kevin.laatz@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210827172048.558704-6-kevin.laatz@intel.com",
    "date": "2021-08-27T17:20:40",
    "name": "[05/13] dma/idxd: create dmadev instances on bus probe",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d02ddd5db74539d60ef0e30dcb3f2b572521ce22",
    "submitter": {
        "id": 921,
        "url": "http://patches.dpdk.org/api/people/921/?format=api",
        "name": "Kevin Laatz",
        "email": "kevin.laatz@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/20210827172048.558704-6-kevin.laatz@intel.com/mbox/",
    "series": [
        {
            "id": 18500,
            "url": "http://patches.dpdk.org/api/series/18500/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18500",
            "date": "2021-08-27T17:20:35",
            "name": "add dmadev driver for idxd devices",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/18500/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/97475/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/97475/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 51D8DA0548;\n\tFri, 27 Aug 2021 19:21:44 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id BA4E941267;\n\tFri, 27 Aug 2021 19:21:19 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 921A44125D\n for <dev@dpdk.org>; Fri, 27 Aug 2021 19:21:17 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Aug 2021 10:21:17 -0700",
            "from silpixa00401122.ir.intel.com ([10.55.128.10])\n by orsmga002.jf.intel.com with ESMTP; 27 Aug 2021 10:21:15 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10089\"; a=\"198235915\"",
            "E=Sophos;i=\"5.84,357,1620716400\"; d=\"scan'208\";a=\"198235915\"",
            "E=Sophos;i=\"5.84,357,1620716400\"; d=\"scan'208\";a=\"445009465\""
        ],
        "X-ExtLoop1": "1",
        "From": "Kevin Laatz <kevin.laatz@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com, fengchengwen@huawei.com, jerinj@marvell.com,\n conor.walsh@intel.com, Kevin Laatz <kevin.laatz@intel.com>",
        "Date": "Fri, 27 Aug 2021 17:20:40 +0000",
        "Message-Id": "<20210827172048.558704-6-kevin.laatz@intel.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210827172048.558704-1-kevin.laatz@intel.com>",
        "References": "<20210827172048.558704-1-kevin.laatz@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 05/13] dma/idxd: create dmadev instances on bus\n probe",
        "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": "When a suitable device is found during the bus scan/probe, create a dmadev\ninstance for each HW queue. Internal structures required for device\ncreation are also added.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\n---\n drivers/dma/idxd/idxd_bus.c      | 20 ++++++++-\n drivers/dma/idxd/idxd_common.c   | 75 ++++++++++++++++++++++++++++++++\n drivers/dma/idxd/idxd_internal.h | 40 +++++++++++++++++\n drivers/dma/idxd/meson.build     |  1 +\n 4 files changed, 135 insertions(+), 1 deletion(-)\n create mode 100644 drivers/dma/idxd/idxd_common.c",
    "diff": "diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c\nindex c08f0f473b..0f33500dfc 100644\n--- a/drivers/dma/idxd/idxd_bus.c\n+++ b/drivers/dma/idxd/idxd_bus.c\n@@ -84,6 +84,18 @@ dsa_get_sysfs_path(void)\n \treturn path ? path : DSA_SYSFS_PATH;\n }\n \n+static int\n+idxd_dev_close(struct rte_dmadev *dev)\n+{\n+\tstruct idxd_dmadev *idxd = dev->data->dev_private;\n+\tmunmap(idxd->portal, 0x1000);\n+\treturn 0;\n+}\n+\n+static const struct rte_dmadev_ops idxd_vdev_ops = {\n+\t\t.dev_close = idxd_dev_close,\n+};\n+\n static void *\n idxd_vdev_mmap_wq(struct rte_dsa_device *dev)\n {\n@@ -205,7 +217,7 @@ idxd_probe_dsa(struct rte_dsa_device *dev)\n \t\treturn -1;\n \tidxd.max_batch_size = ret;\n \tidxd.qid = dev->addr.wq_id;\n-\tidxd.u.vdev.dsa_id = dev->addr.device_id;\n+\tidxd.u.bus.dsa_id = dev->addr.device_id;\n \tidxd.sva_support = 1;\n \n \tidxd.portal = idxd_vdev_mmap_wq(dev);\n@@ -214,6 +226,12 @@ idxd_probe_dsa(struct rte_dsa_device *dev)\n \t\treturn -ENOENT;\n \t}\n \n+\tret = idxd_dmadev_create(dev->wq_name, &dev->device, &idxd, &idxd_vdev_ops);\n+\tif (ret) {\n+\t\tIDXD_PMD_ERR(\"Failed to create rawdev %s\", dev->wq_name);\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c\nnew file mode 100644\nindex 0000000000..7770b2e264\n--- /dev/null\n+++ b/drivers/dma/idxd/idxd_common.c\n@@ -0,0 +1,75 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2021 Intel Corporation\n+ */\n+\n+#include <rte_dmadev_pmd.h>\n+#include <rte_malloc.h>\n+#include <rte_common.h>\n+\n+#include \"idxd_internal.h\"\n+\n+#define IDXD_PMD_NAME_STR \"dmadev_idxd\"\n+\n+int\n+idxd_dmadev_create(const char *name, struct rte_device *dev,\n+\t\t   const struct idxd_dmadev *base_idxd,\n+\t\t   const struct rte_dmadev_ops *ops)\n+{\n+\tstruct idxd_dmadev *idxd;\n+\tstruct rte_dmadev *dmadev = NULL;\n+\tint ret = 0;\n+\n+\tif (!name) {\n+\t\tIDXD_PMD_ERR(\"Invalid name of the device!\");\n+\t\tret = -EINVAL;\n+\t\tgoto cleanup;\n+\t}\n+\n+\t/* Allocate device structure */\n+\tdmadev = rte_dmadev_pmd_allocate(name);\n+\tif (dmadev == NULL) {\n+\t\tIDXD_PMD_ERR(\"Unable to allocate raw device\");\n+\t\tret = -ENOMEM;\n+\t\tgoto cleanup;\n+\t}\n+\tdmadev->dev_ops = ops;\n+\tdmadev->device = dev;\n+\n+\tidxd = rte_malloc_socket(NULL, sizeof(struct idxd_dmadev), 0, dev->numa_node);\n+\tif (idxd == NULL) {\n+\t\tIDXD_PMD_ERR(\"Unable to allocate memory for device\");\n+\t\tret = -ENOMEM;\n+\t\tgoto cleanup;\n+\t}\n+\tdmadev->data->dev_private = idxd;\n+\tdmadev->dev_private = idxd;\n+\t*idxd = *base_idxd; /* copy over the main fields already passed in */\n+\tidxd->dmadev = dmadev;\n+\n+\t/* allocate batch index ring and completion ring.\n+\t * The +1 is because we can never fully use\n+\t * the ring, otherwise read == write means both full and empty.\n+\t */\n+\tidxd->batch_comp_ring = rte_zmalloc(NULL, (sizeof(idxd->batch_idx_ring[0]) +\n+\t\t\tsizeof(idxd->batch_comp_ring[0]))\t* (idxd->max_batches + 1),\n+\t\t\tsizeof(idxd->batch_comp_ring[0]));\n+\tif (idxd->batch_comp_ring == NULL) {\n+\t\tIDXD_PMD_ERR(\"Unable to reserve memory for batch data\\n\");\n+\t\tret = -ENOMEM;\n+\t\tgoto cleanup;\n+\t}\n+\tidxd->batch_idx_ring = (void *)&idxd->batch_comp_ring[idxd->max_batches+1];\n+\tidxd->batch_iova = rte_mem_virt2iova(idxd->batch_comp_ring);\n+\n+\treturn 0;\n+\n+cleanup:\n+\tif (dmadev)\n+\t\trte_dmadev_pmd_release(dmadev);\n+\n+\treturn ret;\n+}\n+\n+int idxd_pmd_logtype;\n+\n+RTE_LOG_REGISTER_DEFAULT(idxd_pmd_logtype, WARNING);\ndiff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h\nindex c6a7dcd72f..99ab2df925 100644\n--- a/drivers/dma/idxd/idxd_internal.h\n+++ b/drivers/dma/idxd/idxd_internal.h\n@@ -24,4 +24,44 @@ extern int idxd_pmd_logtype;\n #define IDXD_PMD_ERR(fmt, args...)    IDXD_PMD_LOG(ERR, fmt, ## args)\n #define IDXD_PMD_WARN(fmt, args...)   IDXD_PMD_LOG(WARNING, fmt, ## args)\n \n+struct idxd_dmadev {\n+\t/* counters to track the batches */\n+\tunsigned short max_batches;\n+\tunsigned short batch_idx_read;\n+\tunsigned short batch_idx_write;\n+\n+\t/* track descriptors and handles */\n+\tunsigned short desc_ring_mask;\n+\tunsigned short ids_avail; /* handles for ops completed */\n+\tunsigned short ids_returned; /* the read pointer for hdls/desc rings */\n+\tunsigned short batch_start; /* start+size == write pointer for hdls/desc */\n+\tunsigned short batch_size;\n+\n+\tvoid *portal; /* address to write the batch descriptor */\n+\n+\tstruct idxd_completion *batch_comp_ring;\n+\tunsigned short *batch_idx_ring; /* store where each batch ends */\n+\n+\tstruct rte_dmadev_stats stats;\n+\n+\trte_iova_t batch_iova; /* base address of the batch comp ring */\n+\trte_iova_t desc_iova; /* base address of desc ring, needed for completions */\n+\n+\tunsigned short max_batch_size;\n+\n+\tstruct rte_dmadev *dmadev;\n+\tstruct rte_dmadev_vchan_conf qcfg;\n+\tuint8_t sva_support;\n+\tuint8_t qid;\n+\n+\tunion {\n+\t\tstruct {\n+\t\t\tunsigned int dsa_id;\n+\t\t} bus;\n+\t} u;\n+};\n+\n+int idxd_dmadev_create(const char *name, struct rte_device *dev,\n+\t\tconst struct idxd_dmadev *base_idxd, const struct rte_dmadev_ops *ops);\n+\n #endif /* _IDXD_INTERNAL_H_ */\ndiff --git a/drivers/dma/idxd/meson.build b/drivers/dma/idxd/meson.build\nindex f1fea000a7..81150e6f25 100644\n--- a/drivers/dma/idxd/meson.build\n+++ b/drivers/dma/idxd/meson.build\n@@ -4,5 +4,6 @@\n deps += ['bus_pci']\n sources = files(\n         'idxd_bus.c',\n+        'idxd_common.c',\n         'idxd_pci.c'\n )\n\\ No newline at end of file\n",
    "prefixes": [
        "05/13"
    ]
}