get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94250,
    "url": "http://patches.dpdk.org/api/patches/94250/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1623763327-30987-1-git-send-email-fengchengwen@huawei.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": "<1623763327-30987-1-git-send-email-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1623763327-30987-1-git-send-email-fengchengwen@huawei.com",
    "date": "2021-06-15T13:22:07",
    "name": "[RFC] dmadev: introduce DMA device library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "66e08a49a8eda65737683adbaa069fd3c405f1b6",
    "submitter": {
        "id": 2146,
        "url": "http://patches.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.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/1623763327-30987-1-git-send-email-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 17338,
            "url": "http://patches.dpdk.org/api/series/17338/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=17338",
            "date": "2021-06-15T13:22:07",
            "name": "[RFC] dmadev: introduce DMA device library",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/17338/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/94250/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/94250/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 78E26A0C47;\n\tTue, 15 Jun 2021 15:25:40 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E56504067A;\n\tTue, 15 Jun 2021 15:25:39 +0200 (CEST)",
            "from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255])\n by mails.dpdk.org (Postfix) with ESMTP id 7DDBE40140\n for <dev@dpdk.org>; Tue, 15 Jun 2021 15:25:37 +0200 (CEST)",
            "from dggemv704-chm.china.huawei.com (unknown [172.30.72.57])\n by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4G487z1Rbpz1BMq3;\n Tue, 15 Jun 2021 21:20:31 +0800 (CST)",
            "from dggpeml500024.china.huawei.com (7.185.36.10) by\n dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2176.2; Tue, 15 Jun 2021 21:25:27 +0800",
            "from localhost.localdomain (10.67.165.24) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2176.2; Tue, 15 Jun 2021 21:25:26 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<thomas@monjalon.net>, <ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, <nipun.gupta@nxp.com>, <hemant.agrawal@nxp.com>,\n <maxime.coquelin@redhat.com>, <honnappa.nagarahalli@arm.com>,\n <jerinj@marvell.com>, <david.marchand@redhat.com>,\n <bruce.richardson@intel.com>, <jerinjacobk@gmail.com>",
        "Date": "Tue, 15 Jun 2021 21:22:07 +0800",
        "Message-ID": "<1623763327-30987-1-git-send-email-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.8.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.24]",
        "X-ClientProxiedBy": "dggems705-chm.china.huawei.com (10.3.19.182) To\n dggpeml500024.china.huawei.com (7.185.36.10)",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [RFC PATCH] dmadev: introduce DMA device library",
        "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": "This patch introduces 'dmadevice' which is a generic type of DMA\ndevice.\n\nThe APIs of dmadev library exposes some generic operations which can\nenable configuration and I/O with the DMA devices.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n lib/dmadev/rte_dmadev.h     | 531 ++++++++++++++++++++++++++++++++++++++++++++\n lib/dmadev/rte_dmadev_pmd.h | 384 ++++++++++++++++++++++++++++++++\n 2 files changed, 915 insertions(+)\n create mode 100644 lib/dmadev/rte_dmadev.h\n create mode 100644 lib/dmadev/rte_dmadev_pmd.h",
    "diff": "diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h\nnew file mode 100644\nindex 0000000..ca7c8a8\n--- /dev/null\n+++ b/lib/dmadev/rte_dmadev.h\n@@ -0,0 +1,531 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2021 HiSilicon Limited.\n+ */\n+\n+#ifndef _RTE_DMADEV_H_\n+#define _RTE_DMADEV_H_\n+\n+/**\n+ * @file rte_dmadev.h\n+ *\n+ * DMA (Direct Memory Access) device APIs.\n+ *\n+ * Defines RTE DMA Device APIs for DMA operations and its provisioning.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_common.h>\n+#include <rte_memory.h>\n+#include <rte_errno.h>\n+#include <rte_compat.h>\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Get the total number of DMA devices that have been successfully\n+ * initialised.\n+ *\n+ * @return\n+ *   The total number of usable DMA devices.\n+ */\n+__rte_experimental\n+uint16_t\n+rte_dmadev_count(void);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Get the device identifier for the named DMA device.\n+ *\n+ * @param name\n+ *   DMA device name to select the DMA device identifier.\n+ *\n+ * @return\n+ *   Returns DMA device identifier on success.\n+ *   - <0: Failure to find named DMA device.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_get_dev_id(const char *name);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Return the NUMA socket to which a device is connected.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   The NUMA socket id to which the device is connected or\n+ *   a default of zero if the socket could not be determined.\n+ *   - -EINVAL: dev_id value is out of range.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_socket_id(uint16_t dev_id);\n+\n+/**\n+ * The capabilities of a DMA device.\n+ */\n+#define RTE_DMA_DEV_CAPA_FILL\t(1ull << 0) /**< Support fill ops */\n+#define RTE_DMA_DEV_CAPA_FENCE\t(1ull << 1) /**< Support fence ops */\n+#define RTE_DMA_DEV_CAPA_HANDLE\t(1ull << 2) /**< Support opaque handle */\n+\n+/**\n+ * DMA device information\n+ */\n+struct rte_dmadev_info {\n+\tconst char *driver_name; /**< DMA driver name. */\n+\tstruct rte_device *device; /**< Device information. */\n+\tuint64_t dev_capa; /**< Device capabilities (RTE_DMA_DEV_CAPA_). */\n+\tuint16_t nb_max_desc; /**< Max allowed number of descriptors. */\n+\tuint16_t nb_min_desc; /**< Min allowed number of descriptors. */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Retrieve the contextual information of a DMA device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @param[out] dev_info\n+ *   A pointer to a structure of type *rte_dmadev_info* to be filled with the\n+ *   contextual information of the device.\n+ * @return\n+ *   - 0: Success, driver updates the contextual information of the DMA device\n+ *   - <0: Error code returned by the driver info get function.\n+ *\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_info_get(uint16_t dev_id, struct rte_dmadev_info *dev_info);\n+\n+/**\n+ * A structure used to configure a DMA device.\n+ */\n+struct rte_dmadev_conf {\n+\tuint16_t nb_desc; /**< The number of submission descriptor ring size */\n+\tbool handle_enable; /**< if set, process user-supplied opaque handle */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Configure a DMA device.\n+ *\n+ * This function must be invoked first before any other function in the\n+ * API. This function can also be re-invoked when a device is in the\n+ * stopped state.\n+ *\n+ * The caller may use rte_dmadev_info_get() to get the capability of each\n+ * resources available for this DMA device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device to configure.\n+ * @param dev_conf\n+ *   The DMA device configuration structure encapsulated into rte_dmadev_conf\n+ *   object.\n+ *\n+ * @return\n+ *   - 0: Success, device configured.\n+ *   - <0: Error code returned by the driver configuration function.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_configure(uint16_t dev_id, struct rte_dmadev_conf *dev_conf);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Start a DMA device.\n+ *\n+ * The device start step is the last one and consists of setting the DMA\n+ * to start accepting jobs (e.g. fill or copy).\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: Success, device started.\n+ *   < 0: Error code returned by the driver start function.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_start(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Stop a DMA device. The device can be restarted with a call to\n+ * rte_dmadev_start()\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: Success, device stopped.\n+ *   - <0: Error code returned by the driver stop function.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_stop(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Close a DMA device. The device cannot be restarted after this call.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *  - 0 on successfully closing device\n+ *  - <0 on failure to close device\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_close(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Reset a DMA device.\n+ * This is different from cycle of rte_dmadev_start->rte_dmadev_stop in the\n+ * sense similar to hard or soft reset.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0 on successful reset device.\n+ *   - <0 on failure to reset device.\n+ *   - (-ENOTSUP) if the device doesn't support this function.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_reset(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Enqueue a fill operation onto the DMA device\n+ *\n+ * This queues up a fill operation to be performed by hardware, but does not\n+ * trigger hardware to begin that operation.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param pattern\n+ *   The pattern to populate the destination buffer with.\n+ * @param dst\n+ *   The address of the destination buffer.\n+ * @param len\n+ *   The length of the destination buffer.\n+ * @param op_handle\n+ *   An opaque handle for this operation, may be returned when completed or\n+ *   completed_error.\n+ *\n+ * @return\n+ *   Number of operations enqueued, either 0 or 1\n+ */\n+__rte_experimental\n+static inline int\n+rte_dmadev_fill(uint16_t dev_id, uint64_t pattern, rte_iova_t dst,\n+\t\tuint32_t len, uintptr_t op_handle);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Enqueue a copy operation onto the DMA device.\n+ *\n+ * This queues up a copy operation to be performed by hardware, but does not\n+ * trigger hardware to begin that operation.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param src\n+ *   The address of the source buffer.\n+ * @param dst\n+ *   The address of the destination buffer.\n+ * @param len\n+ *   The length of the data to be copied.\n+ * @param op_handle\n+ *   An opaque handle for this operation, may be returned when completed or\n+ *   completed_error.\n+ *\n+ * @return\n+ *   Number of operations enqueued, either 0 or 1.\n+ */\n+__rte_experimental\n+static inline int\n+rte_dmadev_copy(uint16_t dev_id, rte_iova_t src, rte_iova_t dst,\n+\t\tuint32_t len, uintptr_t op_handle);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Add a fence to force ordering between operations\n+ *\n+ * This adds a fence to a sequence of operations to enforce ordering, such that\n+ * all operations enqueued before the fence must be completed before operations\n+ * after the fence.\n+ * NOTE: Since this fence may be added as a flag to the last operation enqueued,\n+ * this API may not function correctly when called immediately after an\n+ * \"rte_dmadev_perform_ops\" call i.e. before any new operations are enqueued.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: on successful add fence.\n+ *   - <0: on failure to add fence.\n+ */\n+__rte_experimental\n+static inline int\n+rte_dmadev_fence(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Trigger hardware to begin performing enqueued operations\n+ *\n+ * This API is used to write the \"doorbell\" to the hardware to trigger it\n+ * to begin the operations previously enqueued by rte_dmadev_enqueue_xxx()\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: on successful trigger hardware.\n+ *   - <0: on failure to trigger hardware.\n+ */\n+__rte_experimental\n+static inline int\n+rte_dmadev_perform(uint16_t dev_id);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Returns the number of operations that have been successful completed.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param op_handle\n+ *   Return the lastest completed operation's opaque handle which passed by fill\n+ *   or copy ops.\n+ *   NOTE: If handle_enable configuration option for the device was not set,\n+ *   this parameter is ignored, and may be NULL.\n+ *\n+ * @return\n+ *   -1 on device error, with rte_errno set appropriately and parameters\n+ *   unmodified.\n+ *   Otherwise number of successful completed operations.\n+ */\n+__rte_experimental\n+static inline int\n+rte_dmadev_completed(uint16_t dev_id, uintptr_t *op_handle);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Returns the number of operations that failed to complete.\n+ * NOTE: This API was used when rte_dmadev_completed return -1.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param op_handle\n+ *   Return the lastest failed operation's opaque handle which passed by fill\n+ *   or copy ops.\n+ *   NOTE: If handle_enable configuration option for the device was not set,\n+ *   this parameter is ignored, and may be NULL.\n+ *\n+ * @return\n+ *   The number of failed to complete operations (due to some error, e.g.\n+ *   hardware errors)\n+ */\n+__rte_experimental\n+static inline uint16_t\n+rte_dmadev_completed_error(uint16_t dev_id, uintptr_t *op_handle);\n+\n+/** Maximum name length for extended statistics counters */\n+#define RTE_DMA_DEV_XSTATS_NAME_SIZE 64\n+\n+/**\n+ * A name-key lookup element for extended statistics.\n+ *\n+ * This structure is used to map between names and ID numbers\n+ * for extended ethdev statistics.\n+ */\n+struct rte_dmadev_xstats_name {\n+\tchar name[RTE_DMA_DEV_XSTATS_NAME_SIZE];\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Retrieve names of extended statistics of a DMA device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param[out] xstats_names\n+ *   Block of memory to insert names into. Must be at least size in capacity.\n+ *   If set to NULL, function returns required capacity.\n+ * @param size\n+ *   Capacity of xstats_names (number of names).\n+ * @return\n+ *   - positive value lower or equal to size: success. The return value\n+ *     is the number of entries filled in the stats table.\n+ *   - positive value higher than size: error, the given statistics table\n+ *     is too small. The return value corresponds to the size that should\n+ *     be given to succeed. The entries in the table are not valid and\n+ *     shall not be used by the caller.\n+ *   - negative value on error:\n+ *        -ENODEV for invalid *dev_id*\n+ *        -ENOTSUP if the device doesn't support this function.\n+ */\n+int\n+rte_dmadev_xstats_names_get(uint16_t dev_id,\n+\t\t\t    struct rte_dmadev_xstats_name *xstats_names,\n+\t\t\t    unsigned int size);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Retrieve extended statistics of a DMA device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param ids\n+ *   The id numbers of the stats to get. The ids can be got from the stat\n+ *   position in the stat list from rte_dmadev_get_xstats_names(), or\n+ *   by using rte_dmadev_get_xstats_by_name()\n+ * @param[out] values\n+ *   The values for each stats request by ID.\n+ * @param n\n+ *   The number of stats requested\n+ * @return\n+ *   - positive value: number of stat entries filled into the values array\n+ *   - negative value on error:\n+ *        -ENODEV for invalid *dev_id*\n+ *        -ENOTSUP if the device doesn't support this function.\n+ */\n+int\n+rte_dmadev_xstats_get(uint16_t dev_id,\n+\t\t      const unsigned int ids[],\n+\t\t      uint64_t values[],\n+\t\t      unsigned int n);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Reset the values of the xstats of the selected component in the device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device\n+ * @param ids\n+ *   Selects specific statistics to be reset. When NULL, all statistics\n+ *   will be reset. If non-NULL, must point to array of at least\n+ *   *nb_ids* size.\n+ * @param nb_ids\n+ *   The number of ids available from the *ids* array. Ignored when ids is NULL.\n+ * @return\n+ *   - zero: successfully reset the statistics to zero\n+ *   - negative value on error:\n+ *        -EINVAL invalid parameters\n+ *        -ENOTSUP if not supported.\n+ */\n+int\n+rte_dmadev_xstats_reset(uint16_t dev_id,\n+\t\t\tconst uint32_t ids[],\n+\t\t\tuint32_t nb_ids);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Dump internal information about *dev_id* to the FILE* provided in *f*.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @param f\n+ *   A pointer to a file for output.\n+ *\n+ * @return\n+ *   - 0: on successful dump device.\n+ *   - <0: on failure to dump device.\n+ *   - (-ENOTSUP) if the device doesn't support this function.\n+ */\n+__rte_experimental\n+int\n+rte_dmadev_dump(uint16_t dev_id, FILE *f);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Trigger the dmadev self test.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: Selftest successful.\n+ *   - -ENOTSUP if the device doesn't support selftest\n+ *   - other values < 0 on failure.\n+ */\n+int\n+rte_dmadev_selftest(uint16_t dev_id);\n+\n+\n+struct rte_dmadev_ops;\n+\n+#define RTE_DMADEV_NAME_MAX_LEN\t(64)\n+/**< @internal Max length of name of DMA PMD */\n+\n+/** @internal\n+ * The data structure associated with each DMA device.\n+ */\n+struct rte_dmadev {\n+\t/**< Device ID for this instance */\n+\tuint16_t dev_id;\n+\t/**< Functions exported by PMD */\n+\tconst struct rte_dmadev_ops *dev_ops;\n+\t/**< Device info. supplied during device initialization */\n+\tstruct rte_device *device;\n+\t/**< Driver info. supplied by probing */\n+\tconst char *driver_name;\n+\n+\t/**< Device name */\n+\tchar name[RTE_DMADEV_NAME_MAX_LEN];\n+} __rte_cache_aligned;\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_DMADEV_H_ */\ndiff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h\nnew file mode 100644\nindex 0000000..faa3909\n--- /dev/null\n+++ b/lib/dmadev/rte_dmadev_pmd.h\n@@ -0,0 +1,384 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2021 HiSilicon Limited.\n+ */\n+\n+#ifndef _RTE_DMADEV_PMD_H_\n+#define _RTE_DMADEV_PMD_H_\n+\n+/** @file\n+ * RTE DMA PMD APIs\n+ *\n+ * @note\n+ * Driver facing APIs for a DMA device. These are not to be called directly by\n+ * any application.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <string.h>\n+\n+#include <rte_dev.h>\n+#include <rte_common.h>\n+\n+#include \"rte_dmadev.h\"\n+\n+/**\n+ * Get the rte_dmadev structure device pointer for the named device.\n+ *\n+ * @param name\n+ *   device name to select the device structure.\n+ *\n+ * @return\n+ *   - The rte_dmadev structure pointer for the given device name.\n+ */\n+struct rte_dmadev *\n+rte_dmadev_pmd_get_named_dev(const char *name);\n+\n+/**\n+ * Definitions of all functions exported by a driver through the\n+ * generic structure of type *dmadev_ops* supplied in the *rte_dmadev*\n+ * structure associated with a device.\n+ */\n+\n+/**\n+ * Get device information of a device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ * @param dev_info\n+ *   DMA device information structure\n+ *\n+ * @return\n+ *   Returns 0 on success, negative error code on failure\n+ */\n+typedef int (*dmadev_info_get_t)(struct rte_dmadev *dev,\n+\t\t\t\t struct rte_dmadev_info *dev_info);\n+\n+/**\n+ * Configure a device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ * @param config\n+ *   DMA device configuration structure\n+ *\n+ * @return\n+ *   Returns 0 on success\n+ */\n+typedef int (*dmadev_configure_t)(const struct rte_dmadev *dev,\n+\t\t\t\t  struct rte_dmadev_conf *config);\n+\n+/**\n+ * Start a configured device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ *\n+ * @return\n+ *   Returns 0 on success\n+ */\n+typedef int (*dmadev_start_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Stop a configured device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ *\n+ * @return\n+ *   Return 0 on success\n+ */\n+typedef int (*dmadev_stop_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Close a configured device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ *\n+ * @return\n+ *   Return 0 on success\n+ */\n+typedef int (*dmadev_close_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Reset a configured device.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ *\n+ * @return\n+ *   0 for success\n+ *   !0 for failure\n+ */\n+typedef int (*dmadev_reset_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Enqueue a fill operation onto the DMA device\n+ *\n+ * This queues up a fill operation to be performed by hardware, but does not\n+ * trigger hardware to begin that operation.\n+ *\n+ * @param dev\n+ *   DMA device pointer.\n+ * @param pattern\n+ *   The pattern to populate the destination buffer with.\n+ * @param dst\n+ *   The address of the destination buffer.\n+ * @param len\n+ *   The length of the destination buffer.\n+ * @param op_handle\n+ *   An opaque handle for this operation, may be returned when completed or\n+ *   completed_error.\n+ *\n+ * @return\n+ *   Number of operations enqueued, either 0 or 1\n+ */\n+typedef int (*dmadev_fill_t)(struct rte_dmadev *dev,\n+\t\t\t     uint64_t pattern, rte_iova_t dst,\n+\t\t\t     uint32_t len, uintptr_t op_handle);\n+\n+/**\n+ * Enqueue a copy operation onto the DMA device.\n+ *\n+ * This queues up a copy operation to be performed by hardware, but does not\n+ * trigger hardware to begin that operation.\n+ *\n+ * @param dev\n+ *   DMA device pointer.\n+ * @param src\n+ *   The address of the source buffer.\n+ * @param dst\n+ *   The address of the destination buffer.\n+ * @param len\n+ *   The length of the data to be copied.\n+ * @param op_handle\n+ *   An opaque handle for this operation, may be returned when completed or\n+ *   completed_error.\n+ *\n+ * @return\n+ *   Number of operations enqueued, either 0 or 1.\n+ */\n+typedef int (*dmadev_copy_t)(struct rte_dmadev *dev,\n+\t\t\t     rte_iova_t src, rte_iova_t dst,\n+\t\t\t     uint32_t len, uintptr_t op_handle);\n+\n+/**\n+ * Add a fence to force ordering between operations\n+ *\n+ * This adds a fence to a sequence of operations to enforce ordering, such that\n+ * all operations enqueued before the fence must be completed before operations\n+ * after the fence.\n+ * NOTE: Since this fence may be added as a flag to the last operation enqueued,\n+ * this API may not function correctly when called immediately after an\n+ * \"rte_dmadev_perform_ops\" call i.e. before any new operations are enqueued.\n+ *\n+ * @param dev\n+ *   DMA device pointer.\n+ *\n+ * @return\n+ *   - 0: on successful add fence.\n+ *   - <0: on failure to add fence.\n+ */\n+typedef int (*dmadev_fence_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Trigger hardware to begin performing enqueued operations\n+ *\n+ * This API is used to write the \"doorbell\" to the hardware to trigger it\n+ * to begin the operations previously enqueued by rte_dmadev_enqueue_xxx()\n+ *\n+ * @param dev\n+ *   DMA device pointer.\n+ *\n+ * @return\n+ *   - 0: on successful trigger hardware.\n+ *   - <0: on failure to trigger hardware.\n+ */\n+typedef int (*dmadev_perform_t)(struct rte_dmadev *dev);\n+\n+/**\n+ * Returns the number of operations that have been successful completed.\n+ *\n+ * @param dev\n+ *   DMA device pointer.\n+ * @param op_handle\n+ *   Return the lastest completed operation's opaque handle which passed by fill\n+ *   or copy ops.\n+ *   NOTE: If handle_enable configuration option for the device was not set,\n+ *   this parameter is ignored, and may be NULL.\n+ *\n+ * @return\n+ *   -1 on device error, with rte_errno set appropriately and parameters\n+ *   unmodified.\n+ *   Otherwise number of successful completed operations.\n+ */\n+typedef int (*dmadev_completed_t)(struct rte_dmadev *dev, uintptr_t *op_handle);\n+\n+/**\n+ * Returns the number of operations that failed to complete.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param op_handle\n+ *   Return the lastest failed operation's opaque handle which passed by fill\n+ *   or copy ops.\n+ *   NOTE: If handle_enable configuration option for the device was not set,\n+ *   this parameter is ignored, and may be NULL.\n+ *\n+ * @return\n+ *   The number of failed completed operations (due to some error, e.g. hardware\n+ *   errors)\n+ */\n+typedef int (*dmadev_completed_error_t)(struct rte_dmadev *dev,\n+\t\t\t\t\tuintptr_t *op_handle);\n+\n+/**\n+ * Retrieve a set of statistics from device.\n+ * Note: Being a DMA device, the stats are specific to the device being\n+ * implemented thus represented as xstats.\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ * @param ids\n+ *   The stat ids to retrieve\n+ * @param values\n+ *   The returned stat values\n+ * @param n\n+ *   The number of id values and entries in the values array\n+ *\n+ * @return\n+ *   The number of stat values successfully filled into the values array\n+ */\n+typedef int (*dmadev_xstats_get_t)(const struct rte_dmadev *dev,\n+\t\tconst unsigned int ids[], uint64_t values[], unsigned int n);\n+\n+/**\n+ * Resets the statistic values in xstats for the device.\n+ */\n+typedef int (*dmadev_xstats_reset_t)(struct rte_dmadev *dev,\n+\t\tconst uint32_t ids[],\n+\t\tuint32_t nb_ids);\n+\n+/**\n+ * Get names of extended stats of an DMA device\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ * @param xstats_names\n+ *   Array of name values to be filled in\n+ * @param size\n+ *   Number of values in the xstats_names array\n+ *\n+ * @return\n+ *   When size >= the number of stats, return the number of stat values filled\n+ *   into the array.\n+ *   When size < the number of available stats, return the number of stats\n+ *   values, and do not fill in any data into xstats_names.\n+ */\n+typedef int (*dmadev_xstats_get_names_t)(const struct rte_dmadev *dev,\n+\t\tstruct rte_dmadev_xstats_name *xstats_names,\n+\t\tunsigned int size);\n+\n+/**\n+ * Dump internal information\n+ *\n+ * @param dev\n+ *   DMA device pointer\n+ * @param f\n+ *   A pointer to a file for output\n+ *\n+ * @return\n+ *   0 for success,\n+ *   !0 Error\n+ *\n+ */\n+typedef int (*dmadev_dump_t)(struct rte_dmadev *dev, FILE *f);\n+\n+/**\n+ * Start dmadev selftest\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   Return 0 on success\n+ */\n+typedef int (*dmadev_selftest_t)(uint16_t dev_id);\n+\n+/** Dmadevice operations function pointer table */\n+struct rte_dmadev_ops {\n+\t/**< Get device info. */\n+\tdmadev_info_get_t dev_info_get;\n+\t/**< Configure device. */\n+\tdmadev_configure_t dev_configure;\n+\t/**< Start device. */\n+\tdmadev_start_t dev_start;\n+\t/**< Stop device. */\n+\tdmadev_stop_t dev_stop;\n+\t/**< Close device. */\n+\tdmadev_close_t dev_close;\n+\t/**< Reset device. */\n+\tdmadev_reset_t dev_reset;\n+\n+\t/**< Enqueue a fill operation onto the DMA device */\n+\tdmadev_fill_t fill;\n+\t/**< Enqueue a copy operation onto the DMA device */\n+\tdmadev_copy_t copy;\n+\t/**< Add a fence to force ordering between operations */\n+\tdmadev_fence_t fence;\n+\t/**< Trigger hardware to begin performing enqueued operations */\n+\tdmadev_perform_t perform;\n+\t/**< Returns the number of operations that successful completed */\n+\tdmadev_completed_t completed;\n+\t/**< Returns the number of operations that failed to complete */\n+\tdmadev_completed_error_t completed_error;\n+\n+\t/**< Get extended device statistics. */\n+\tdmadev_xstats_get_t xstats_get;\n+\t/**< Get names of extended stats. */\n+\tdmadev_xstats_get_names_t xstats_get_names;\n+\t/**< Reset the statistics values in xstats. */\n+\tdmadev_xstats_reset_t xstats_reset;\n+\n+\t/* Dump internal information */\n+\tdmadev_dump_t dump;\n+\n+\t/**< Device selftest function */\n+\tdmadev_selftest_t dev_selftest;\n+};\n+\n+/**\n+ * Allocates a new dmadev slot for an DMA device and returns the pointer\n+ * to that slot for the driver to use.\n+ *\n+ * @param name\n+ *   Unique identifier name for each device\n+ * @param socket_id\n+ *   Socket to allocate resources on.\n+ *\n+ * @return\n+ *   - Slot in the rte_dev_devices array for a new device;\n+ */\n+struct rte_dmadev *\n+rte_dmadev_pmd_allocate(const char *name, int socket_id);\n+\n+/**\n+ * Release the specified dmadev device.\n+ *\n+ * @param dev\n+ *   The *dmadev* pointer is the address of the *rte_dmadev* structure.\n+ *\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+int\n+rte_dmadev_pmd_release(struct rte_dmadev *dev);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_DMADEV_PMD_H_ */\n",
    "prefixes": [
        "RFC"
    ]
}