run a series of copy tests just using some different options for enqueues and completions */
| 110 | |
| 111 | /* run a series of copy tests just using some different options for enqueues and completions */ |
| 112 | static int |
| 113 | do_multi_copies(int16_t dev_id, uint16_t vchan, |
| 114 | int split_batches, /* submit 2 x 16 or 1 x 32 burst */ |
| 115 | int split_completions, /* gather 2 x 16 or 1 x 32 completions */ |
| 116 | int use_completed_status) /* use completed or completed_status function */ |
| 117 | { |
| 118 | struct rte_mbuf *srcs[32], *dsts[32]; |
| 119 | enum rte_dma_status_code sc[32]; |
| 120 | unsigned int i, j; |
| 121 | bool dma_err = false; |
| 122 | |
| 123 | /* Enqueue burst of copies and hit doorbell */ |
| 124 | for (i = 0; i < RTE_DIM(srcs); i++) { |
| 125 | uint64_t *src_data; |
| 126 | |
| 127 | if (split_batches && i == RTE_DIM(srcs) / 2) |
| 128 | rte_dma_submit(dev_id, vchan); |
| 129 | |
| 130 | srcs[i] = rte_pktmbuf_alloc(pool); |
| 131 | dsts[i] = rte_pktmbuf_alloc(pool); |
| 132 | if (srcs[i] == NULL || dsts[i] == NULL) |
| 133 | ERR_RETURN("Error allocating buffers\n"); |
| 134 | |
| 135 | src_data = rte_pktmbuf_mtod(srcs[i], uint64_t *); |
| 136 | for (j = 0; j < COPY_LEN/sizeof(uint64_t); j++) |
| 137 | src_data[j] = rte_rand(); |
| 138 | |
| 139 | if (rte_dma_copy(dev_id, vchan, rte_mbuf_data_iova(srcs[i]), |
| 140 | rte_mbuf_data_iova(dsts[i]), COPY_LEN, 0) != id_count++) |
| 141 | ERR_RETURN("Error with rte_dma_copy for buffer %u\n", i); |
| 142 | } |
| 143 | rte_dma_submit(dev_id, vchan); |
| 144 | |
| 145 | await_hw(dev_id, vchan); |
| 146 | |
| 147 | if (split_completions) { |
| 148 | /* gather completions in two halves */ |
| 149 | uint16_t half_len = RTE_DIM(srcs) / 2; |
| 150 | int ret = rte_dma_completed(dev_id, vchan, half_len, NULL, &dma_err); |
| 151 | if (ret != half_len || dma_err) |
| 152 | ERR_RETURN("Error with rte_dma_completed - first half. ret = %d, expected ret = %u, dma_err = %d\n", |
| 153 | ret, half_len, dma_err); |
| 154 | |
| 155 | ret = rte_dma_completed(dev_id, vchan, half_len, NULL, &dma_err); |
| 156 | if (ret != half_len || dma_err) |
| 157 | ERR_RETURN("Error with rte_dma_completed - second half. ret = %d, expected ret = %u, dma_err = %d\n", |
| 158 | ret, half_len, dma_err); |
| 159 | } else { |
| 160 | /* gather all completions in one go, using either |
| 161 | * completed or completed_status fns |
| 162 | */ |
| 163 | if (!use_completed_status) { |
| 164 | int n = rte_dma_completed(dev_id, vchan, RTE_DIM(srcs), NULL, &dma_err); |
| 165 | if (n != RTE_DIM(srcs) || dma_err) |
| 166 | ERR_RETURN("Error with rte_dma_completed, %u [expected: %zu], dma_err = %d\n", |
| 167 | n, RTE_DIM(srcs), dma_err); |
| 168 | } else { |
| 169 | int n = rte_dma_completed_status(dev_id, vchan, RTE_DIM(srcs), NULL, sc); |
no test coverage detected