1/* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2019 Intel Corporation 3 */ 4 5#ifndef _RTE_IOAT_RAWDEV_H_ 6#define _RTE_IOAT_RAWDEV_H_ 7 8#ifdef __cplusplus 9extern "C" { 10#endif 11 12/** 13 * @file rte_ioat_rawdev.h 14 * 15 * Definitions for using the ioat rawdev device driver 16 * 17 * @warning 18 * @b EXPERIMENTAL: these structures and APIs may change without prior notice 19 */ 20 21#include <rte_common.h> 22 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" 27 28/** 29 * Configuration structure for an ioat rawdev instance 30 * 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. 34 */ 35struct 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 */ 38}; 39 40/** 41 * Enqueue a fill operation onto the ioat device 42 * 43 * This queues up a fill operation to be performed by hardware, but does not 44 * trigger hardware to begin that operation. 45 * 46 * @param dev_id 47 * The rawdev device id of the ioat instance 48 * @param pattern 49 * The pattern to populate the destination buffer with 50 * @param dst 51 * The physical address of the destination buffer 52 * @param length 53 * The length of the destination buffer 54 * @param dst_hdl 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. 59 * @return 60 * Number of operations enqueued, either 0 or 1 61 */ 62static inline int 63__rte_experimental 64rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst, 65 unsigned int length, uintptr_t dst_hdl); 66 67/** 68 * Enqueue a copy operation onto the ioat device 69 * 70 * This queues up a copy operation to be performed by hardware, but does not 71 * trigger hardware to begin that operation. 72 * 73 * @param dev_id 74 * The rawdev device id of the ioat instance 75 * @param src 76 * The physical address of the source buffer 77 * @param dst 78 * The physical address of the destination buffer 79 * @param length 80 * The length of the data to be copied 81 * @param src_hdl 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. 86 * @param dst_hdl 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. 91 * @return 92 * Number of operations enqueued, either 0 or 1 93 */ 94static inline int 95__rte_experimental 96rte_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); 98 99/** 100 * Add a fence to force ordering between operations 101 * 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 104 * after the fence. 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. 108 * 109 * @param dev_id 110 * The rawdev device id of the ioat instance 111 * @return 112 * Number of fences enqueued, either 0 or 1 113 */ 114static inline int 115__rte_experimental 116rte_ioat_fence(int dev_id); 117 118 119/** 120 * Trigger hardware to begin performing enqueued operations 121 * 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() 124 * 125 * @param dev_id 126 * The rawdev device id of the ioat instance 127 */ 128static inline void 129__rte_experimental 130rte_ioat_perform_ops(int dev_id); 131 132/** 133 * Returns details of operations that have been completed 134 * 135 * If the hdls_disable option was not set when the device was configured, 136 * the function will return to the caller the user-provided "handles" for 137 * the copy operations which have been completed by the hardware, and not 138 * already returned by a previous call to this API. 139 * If the hdls_disable option for the device was set on configure, the 140 * max_copies, src_hdls and dst_hdls parameters will be ignored, and the 141 * function returns the number of newly-completed operations. 142 * 143 * @param dev_id 144 * The rawdev device id of the ioat instance 145 * @param max_copies 146 * The number of entries which can fit in the src_hdls and dst_hdls 147 * arrays, i.e. max number of completed operations to report. 148 * NOTE: If hdls_disable configuration option for the device is set, this 149 * parameter is ignored. 150 * @param src_hdls 151 * Array to hold the source handle parameters of the completed ops. 152 * NOTE: If hdls_disable configuration option for the device is set, this 153 * parameter is ignored. 154 * @param dst_hdls 155 * Array to hold the destination handle parameters of the completed ops. 156 * NOTE: If hdls_disable configuration option for the device is set, this 157 * parameter is ignored. 158 * @return 159 * -1 on error, with rte_errno set appropriately. 160 * Otherwise number of completed operations i.e. number of entries written 161 * to the src_hdls and dst_hdls array parameters. 162 */ 163static inline int 164__rte_experimental 165rte_ioat_completed_ops(int dev_id, uint8_t max_copies, 166 uintptr_t *src_hdls, uintptr_t *dst_hdls); 167 168/* include the implementation details from a separate file */ 169#include "rte_ioat_rawdev_fns.h" 170 171#ifdef __cplusplus 172} 173#endif 174 175#endif /* _RTE_IOAT_RAWDEV_H_ */ 176