1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
5 #ifndef _RTE_IOAT_RAWDEV_H_
6 #define _RTE_IOAT_RAWDEV_H_
13 * @file rte_ioat_rawdev.h
15 * Definitions for using the ioat rawdev device driver
18 * @b EXPERIMENTAL: these structures and APIs may change without prior notice
21 #include <rte_common.h>
23 /** Name of the device driver */
24 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
25 /** String reported as the device driver name by rte_rawdev_info_get() */
26 #define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
29 * Configuration structure for an ioat rawdev instance
31 * This structure is to be passed as the ".dev_private" parameter when
32 * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
33 * an ioat rawdev instance.
35 struct rte_ioat_rawdev_config {
36 unsigned short ring_size; /**< size of job submission descriptor ring */
37 bool hdls_disable; /**< if set, ignore user-supplied handle params */
41 * Enqueue a fill operation onto the ioat device
43 * This queues up a fill operation to be performed by hardware, but does not
44 * trigger hardware to begin that operation.
47 * The rawdev device id of the ioat instance
49 * The pattern to populate the destination buffer with
51 * The physical address of the destination buffer
53 * The length of the destination buffer
55 * An opaque handle for the destination data, to be returned when this
56 * operation has been completed and the user polls for the completion details.
57 * NOTE: If hdls_disable configuration option for the device is set, this
58 * parameter is ignored.
60 * Number of operations enqueued, either 0 or 1
64 rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst,
65 unsigned int length, uintptr_t dst_hdl);
68 * Enqueue a copy operation onto the ioat device
70 * This queues up a copy operation to be performed by hardware, but does not
71 * trigger hardware to begin that operation.
74 * The rawdev device id of the ioat instance
76 * The physical address of the source buffer
78 * The physical address of the destination buffer
80 * The length of the data to be copied
82 * An opaque handle for the source data, to be returned when this operation
83 * has been completed and the user polls for the completion details.
84 * NOTE: If hdls_disable configuration option for the device is set, this
85 * parameter is ignored.
87 * An opaque handle for the destination data, to be returned when this
88 * operation has been completed and the user polls for the completion details.
89 * NOTE: If hdls_disable configuration option for the device is set, this
90 * parameter is ignored.
92 * Number of operations enqueued, either 0 or 1
96 rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,
97 unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl);
100 * Add a fence to force ordering between operations
102 * This adds a fence to a sequence of operations to enforce ordering, such that
103 * all operations enqueued before the fence must be completed before operations
105 * NOTE: Since this fence may be added as a flag to the last operation enqueued,
106 * this API may not function correctly when called immediately after an
107 * "rte_ioat_perform_ops" call i.e. before any new operations are enqueued.
110 * The rawdev device id of the ioat instance
112 * Number of fences enqueued, either 0 or 1
116 rte_ioat_fence(int dev_id);
120 * Trigger hardware to begin performing enqueued operations
122 * This API is used to write the "doorbell" to the hardware to trigger it
123 * to begin the operations previously enqueued by rte_ioat_enqueue_copy()
126 * The rawdev device id of the ioat instance
128 * 0 on success. Non-zero return on error.
132 rte_ioat_perform_ops(int dev_id);
135 * Returns details of operations that have been completed
137 * If the hdls_disable option was not set when the device was configured,
138 * the function will return to the caller the user-provided "handles" for
139 * the copy operations which have been completed by the hardware, and not
140 * already returned by a previous call to this API.
141 * If the hdls_disable option for the device was set on configure, the
142 * max_copies, src_hdls and dst_hdls parameters will be ignored, and the
143 * function returns the number of newly-completed operations.
146 * The rawdev device id of the ioat instance
148 * The number of entries which can fit in the src_hdls and dst_hdls
149 * arrays, i.e. max number of completed operations to report.
150 * NOTE: If hdls_disable configuration option for the device is set, this
151 * parameter is ignored.
153 * Array to hold the source handle parameters of the completed ops.
154 * NOTE: If hdls_disable configuration option for the device is set, this
155 * parameter is ignored.
157 * Array to hold the destination handle parameters of the completed ops.
158 * NOTE: If hdls_disable configuration option for the device is set, this
159 * parameter is ignored.
161 * -1 on error, with rte_errno set appropriately.
162 * Otherwise number of completed operations i.e. number of entries written
163 * to the src_hdls and dst_hdls array parameters.
167 rte_ioat_completed_ops(int dev_id, uint8_t max_copies,
168 uintptr_t *src_hdls, uintptr_t *dst_hdls);
170 /* include the implementation details from a separate file */
171 #include "rte_ioat_rawdev_fns.h"
177 #endif /* _RTE_IOAT_RAWDEV_H_ */