dsts[i]->buf_iova + dsts[i]->data_off,
length,
(uintptr_t)srcs[i],
- (uintptr_t)dsts[i],
- 0 /* nofence */) != 1) {
+ (uintptr_t)dsts[i]) != 1) {
printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
i);
return -1;
to better reflect the APIs' purposes, and remove the implication that
they are limited to copy operations only.
[Note: The old API is still provided but marked as deprecated in the code]
+ * Added a new API ``rte_ioat_fence()`` to add a fence between operations.
+ This API replaces the ``fence`` flag parameter in the ``rte_ioat_enqueue_copies()`` function,
+ and is clearer as there is no ambiguity as to whether the flag should be
+ set on the last operation before the fence or the first operation after it.
* **Updated the pipeline library for alignment with the P4 language.**
dst->buf_iova + dst->data_off,
length,
(uintptr_t)src,
- (uintptr_t)dst,
- 0 /* no fence */) != 1) {
+ (uintptr_t)dst) != 1) {
PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
return -1;
}
dsts[i]->buf_iova + dsts[i]->data_off,
length,
(uintptr_t)srcs[i],
- (uintptr_t)dsts[i],
- 0 /* nofence */) != 1) {
+ (uintptr_t)dsts[i]) != 1) {
PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
i);
return -1;
* operation has been completed and the user polls for the completion details.
* NOTE: If hdls_disable configuration option for the device is set, this
* parameter is ignored.
- * @param fence
- * A flag parameter indicating that hardware should not begin to perform any
- * subsequently enqueued copy operations until after this operation has
- * completed
* @return
* Number of operations enqueued, either 0 or 1
*/
static inline int
__rte_experimental
rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,
- unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,
- int fence);
+ unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl);
+
+/**
+ * Add a fence to force ordering between operations
+ *
+ * This adds a fence to a sequence of operations to enforce ordering, such that
+ * all operations enqueued before the fence must be completed before operations
+ * after the fence.
+ * NOTE: Since this fence may be added as a flag to the last operation enqueued,
+ * this API may not function correctly when called immediately after an
+ * "rte_ioat_perform_ops" call i.e. before any new operations are enqueued.
+ *
+ * @param dev_id
+ * The rawdev device id of the ioat instance
+ * @return
+ * Number of fences enqueued, either 0 or 1
+ */
+static inline int
+__rte_experimental
+rte_ioat_fence(int dev_id);
+
/**
* Trigger hardware to begin performing enqueued operations
*/
static inline int
rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,
- unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,
- int fence)
+ unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl)
{
struct rte_ioat_rawdev *ioat =
(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
desc = &ioat->desc_ring[write];
desc->size = length;
/* set descriptor write-back every 16th descriptor */
- desc->u.control_raw = (uint32_t)((!!fence << 4) | (!(write & 0xF)) << 3);
+ desc->u.control_raw = (uint32_t)((!(write & 0xF)) << 3);
desc->src_addr = src;
desc->dest_addr = dst;
return 1;
}
+/* add fence to last written descriptor */
+static inline int
+rte_ioat_fence(int dev_id)
+{
+ struct rte_ioat_rawdev *ioat =
+ (struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+ unsigned short write = ioat->next_write;
+ unsigned short mask = ioat->ring_size - 1;
+ struct rte_ioat_generic_hw_desc *desc;
+
+ write = (write - 1) & mask;
+ desc = &ioat->desc_ring[write];
+
+ desc->u.control.fence = 1;
+ return 0;
+}
+
/*
* Trigger hardware to begin performing enqueued operations
*/
for (i = 0; i < nb_rx; i++) {
/* Perform data copy */
ret = rte_ioat_enqueue_copy(dev_id,
- pkts[i]->buf_iova
- - addr_offset,
- pkts_copy[i]->buf_iova
- - addr_offset,
- rte_pktmbuf_data_len(pkts[i])
- + addr_offset,
+ pkts[i]->buf_iova - addr_offset,
+ pkts_copy[i]->buf_iova - addr_offset,
+ rte_pktmbuf_data_len(pkts[i]) + addr_offset,
(uintptr_t)pkts[i],
- (uintptr_t)pkts_copy[i],
- 0 /* nofence */);
+ (uintptr_t)pkts_copy[i]);
if (ret != 1)
break;