get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98323,
    "url": "http://patches.dpdk.org/api/patches/98323/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210908103016.1661914-9-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": "<20210908103016.1661914-9-kevin.laatz@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210908103016.1661914-9-kevin.laatz@intel.com",
    "date": "2021-09-08T10:30:07",
    "name": "[v3,08/17] dma/idxd: add configure and info_get functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0680a66fdab46db10594468f7e8e675449c45483",
    "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/20210908103016.1661914-9-kevin.laatz@intel.com/mbox/",
    "series": [
        {
            "id": 18762,
            "url": "http://patches.dpdk.org/api/series/18762/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18762",
            "date": "2021-09-08T10:29:59",
            "name": "add dmadev driver for idxd devices",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/18762/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/98323/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/98323/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 81C67A0C56;\n\tWed,  8 Sep 2021 12:31:13 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7EDF5411BE;\n\tWed,  8 Sep 2021 12:30:39 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by mails.dpdk.org (Postfix) with ESMTP id 8B1B041195\n for <dev@dpdk.org>; Wed,  8 Sep 2021 12:30:36 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Sep 2021 03:30:36 -0700",
            "from silpixa00401122.ir.intel.com ([10.55.128.10])\n by orsmga001.jf.intel.com with ESMTP; 08 Sep 2021 03:30:34 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10100\"; a=\"281461959\"",
            "E=Sophos;i=\"5.85,277,1624345200\"; d=\"scan'208\";a=\"281461959\"",
            "E=Sophos;i=\"5.85,277,1624345200\"; d=\"scan'208\";a=\"513213872\""
        ],
        "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": "Wed,  8 Sep 2021 10:30:07 +0000",
        "Message-Id": "<20210908103016.1661914-9-kevin.laatz@intel.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210908103016.1661914-1-kevin.laatz@intel.com>",
        "References": "<20210903105001.1179328-1-kevin.laatz@intel.com>\n <20210908103016.1661914-1-kevin.laatz@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 08/17] dma/idxd: add configure and info_get\n functions",
        "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": "Add functions for device configuration. The info_get function is included\nhere since it can be useful for checking successful configuration.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\n\n---\nv2:\n   - fix reconfigure bug in idxd_vchan_setup()\n   - add literal include comment for the docs to pick up\nv3:\n   - fixes needed after changes from rebasing\n---\n app/test/test_dmadev.c           |  2 +\n doc/guides/dmadevs/idxd.rst      | 33 +++++++++++++++\n drivers/dma/idxd/idxd_bus.c      |  3 ++\n drivers/dma/idxd/idxd_common.c   | 73 ++++++++++++++++++++++++++++++++\n drivers/dma/idxd/idxd_internal.h |  6 +++\n drivers/dma/idxd/idxd_pci.c      |  3 ++\n 6 files changed, 120 insertions(+)",
    "diff": "diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c\nindex 98dddae6d6..a5276d4cce 100644\n--- a/app/test/test_dmadev.c\n+++ b/app/test/test_dmadev.c\n@@ -739,6 +739,7 @@ test_dmadev_instance(uint16_t dev_id)\n {\n #define TEST_RINGSIZE 512\n #define CHECK_ERRS    true\n+\t/* Setup of the dmadev device. 8< */\n \tstruct rte_dmadev_stats stats;\n \tstruct rte_dmadev_info info;\n \tconst struct rte_dmadev_conf conf = { .nb_vchans = 1};\n@@ -759,6 +760,7 @@ test_dmadev_instance(uint16_t dev_id)\n \n \tif (rte_dmadev_vchan_setup(dev_id, vchan, &qconf) < 0)\n \t\tERR_RETURN(\"Error with queue configuration\\n\");\n+\t/* >8 End of setup of the dmadev device. */\n \n \trte_dmadev_info_get(dev_id, &info);\n \tif (info.nb_vchans != 1)\ndiff --git a/doc/guides/dmadevs/idxd.rst b/doc/guides/dmadevs/idxd.rst\nindex ce33e2857a..66bc9fe744 100644\n--- a/doc/guides/dmadevs/idxd.rst\n+++ b/doc/guides/dmadevs/idxd.rst\n@@ -120,3 +120,36 @@ use a subset of configured queues.\n Once probed successfully, irrespective of kernel driver, the device will appear as a ``dmadev``,\n that is a \"DMA device type\" inside DPDK, and can be accessed using APIs from the\n ``rte_dmadev`` library.\n+\n+Using IDXD DMAdev Devices\n+--------------------------\n+\n+To use the devices from an application, the dmadev API can be used.\n+\n+Getting Device Information\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Basic information about each dmadev device can be queried using the\n+``rte_dmadev_info_get()`` API. This will return basic device information such as\n+the ``rte_device`` structure, device capabilities and other device specific values.\n+\n+Device Configuration\n+~~~~~~~~~~~~~~~~~~~~~\n+\n+Configuring an IDXD dmadev device is done using the ``rte_dmadev_configure()`` and\n+``rte_dmadev_vchan_setup`` APIs. The configurations are passed to these APIs using\n+the ``rte_dmadev_conf`` and ``rte_dmadev_vchan_conf`` structures, respectively. For\n+example, these can be used to configure the number of ``vchans`` per device, the\n+ring size, etc. The ring size must be a power of two, between 64 and 4096.\n+\n+The following code shows how the device is configured in\n+``test_dmadev.c``:\n+\n+.. literalinclude:: ../../../app/test/test_dmadev.c\n+   :language: c\n+   :start-after: Setup of the dmadev device. 8<\n+   :end-before: >8 End of setup of the dmadev device.\n+   :dedent: 1\n+\n+Once configured, the device can then be made ready for use by calling the\n+``rte_dmadev_start()`` API.\ndiff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c\nindex 20d17c20ca..7a6afabd27 100644\n--- a/drivers/dma/idxd/idxd_bus.c\n+++ b/drivers/dma/idxd/idxd_bus.c\n@@ -96,6 +96,9 @@ idxd_dev_close(struct rte_dmadev *dev)\n static const struct rte_dmadev_ops idxd_vdev_ops = {\n \t\t.dev_close = idxd_dev_close,\n \t\t.dev_dump = idxd_dump,\n+\t\t.dev_configure = idxd_configure,\n+\t\t.vchan_setup = idxd_vchan_setup,\n+\t\t.dev_info_get = idxd_info_get,\n };\n \n static void *\ndiff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c\nindex 9490439fdc..9949608293 100644\n--- a/drivers/dma/idxd/idxd_common.c\n+++ b/drivers/dma/idxd/idxd_common.c\n@@ -39,6 +39,79 @@ idxd_dump(const struct rte_dmadev *dev, FILE *f)\n \treturn 0;\n }\n \n+int\n+idxd_info_get(const struct rte_dmadev *dev, struct rte_dmadev_info *info, uint32_t size)\n+{\n+\tstruct idxd_dmadev *idxd = dev->dev_private;\n+\n+\tif (size < sizeof(*info))\n+\t\treturn -EINVAL;\n+\n+\t*info = (struct rte_dmadev_info) {\n+\t\t\t.device = dev->device,\n+\t\t\t.dev_capa = RTE_DMADEV_CAPA_MEM_TO_MEM |\n+\t\t\t\tRTE_DMADEV_CAPA_OPS_COPY | RTE_DMADEV_CAPA_OPS_FILL,\n+\t\t\t.max_vchans = 1,\n+\t\t\t.max_desc = 4096,\n+\t\t\t.min_desc = 64,\n+\t\t\t.nb_vchans = (idxd->desc_ring != NULL), /* returns 1 or 0 */\n+\t};\n+\tif (idxd->sva_support)\n+\t\tinfo->dev_capa |= RTE_DMADEV_CAPA_SVA;\n+\treturn 0;\n+}\n+\n+int\n+idxd_configure(struct rte_dmadev *dev __rte_unused, const struct rte_dmadev_conf *dev_conf,\n+\t\tuint32_t conf_sz)\n+{\n+\tif (sizeof(struct rte_dmadev_conf) != conf_sz)\n+\t\treturn -EINVAL;\n+\n+\tif (dev_conf->nb_vchans != 1)\n+\t\treturn -EINVAL;\n+\treturn 0;\n+}\n+\n+int\n+idxd_vchan_setup(struct rte_dmadev *dev, uint16_t vchan __rte_unused,\n+\t\tconst struct rte_dmadev_vchan_conf *qconf, uint32_t qconf_sz)\n+{\n+\tstruct idxd_dmadev *idxd = dev->dev_private;\n+\tuint16_t max_desc = qconf->nb_desc;\n+\n+\tif (sizeof(struct rte_dmadev_vchan_conf) != qconf_sz)\n+\t\treturn -EINVAL;\n+\n+\tidxd->qcfg = *qconf;\n+\n+\tif (!rte_is_power_of_2(max_desc))\n+\t\tmax_desc = rte_align32pow2(max_desc);\n+\tIDXD_PMD_DEBUG(\"DMA dev %u using %u descriptors\", dev->data->dev_id, max_desc);\n+\tidxd->desc_ring_mask = max_desc - 1;\n+\tidxd->qcfg.nb_desc = max_desc;\n+\n+\t/* in case we are reconfiguring a device, free any existing memory */\n+\trte_free(idxd->desc_ring);\n+\n+\t/* allocate the descriptor ring at 2x size as batches can't wrap */\n+\tidxd->desc_ring = rte_zmalloc(NULL, sizeof(*idxd->desc_ring) * max_desc * 2, 0);\n+\tif (idxd->desc_ring == NULL)\n+\t\treturn -ENOMEM;\n+\tidxd->desc_iova = rte_mem_virt2iova(idxd->desc_ring);\n+\n+\tidxd->batch_idx_read = 0;\n+\tidxd->batch_idx_write = 0;\n+\tidxd->batch_start = 0;\n+\tidxd->batch_size = 0;\n+\tidxd->ids_returned = 0;\n+\tidxd->ids_avail = 0;\n+\n+\tmemset(idxd->batch_comp_ring, 0, sizeof(*idxd->batch_comp_ring) *\n+\t\t\t(idxd->max_batches + 1));\n+\treturn 0;\n+}\n+\n int\n idxd_dmadev_create(const char *name, struct rte_device *dev,\n \t\t   const struct idxd_dmadev *base_idxd,\ndiff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h\nindex e558258ec4..dde0d54df4 100644\n--- a/drivers/dma/idxd/idxd_internal.h\n+++ b/drivers/dma/idxd/idxd_internal.h\n@@ -82,5 +82,11 @@ struct idxd_dmadev {\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 int idxd_dump(const struct rte_dmadev *dev, FILE *f);\n+int idxd_configure(struct rte_dmadev *dev, const struct rte_dmadev_conf *dev_conf,\n+\t\tuint32_t conf_sz);\n+int idxd_vchan_setup(struct rte_dmadev *dev, uint16_t vchan,\n+\t\tconst struct rte_dmadev_vchan_conf *qconf, uint32_t qconf_sz);\n+int idxd_info_get(const struct rte_dmadev *dev, struct rte_dmadev_info *dev_info,\n+\t\tuint32_t size);\n \n #endif /* _IDXD_INTERNAL_H_ */\ndiff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c\nindex 96d58c8544..569df8d04c 100644\n--- a/drivers/dma/idxd/idxd_pci.c\n+++ b/drivers/dma/idxd/idxd_pci.c\n@@ -61,6 +61,9 @@ idxd_is_wq_enabled(struct idxd_dmadev *idxd)\n \n static const struct rte_dmadev_ops idxd_pci_ops = {\n \t.dev_dump = idxd_dump,\n+\t.dev_configure = idxd_configure,\n+\t.vchan_setup = idxd_vchan_setup,\n+\t.dev_info_get = idxd_info_get,\n };\n \n /* each portal uses 4 x 4k pages */\n",
    "prefixes": [
        "v3",
        "08/17"
    ]
}