| 216 | } |
| 217 | |
| 218 | static inline int |
| 219 | do_dma_mem_copy(void *p) |
| 220 | { |
| 221 | struct lcore_params *para = (struct lcore_params *)p; |
| 222 | volatile struct worker_info *worker_info = &(para->worker_info); |
| 223 | const uint16_t dev_id = para->dev_id; |
| 224 | const uint32_t nr_buf = para->nr_buf; |
| 225 | const uint16_t kick_batch = para->kick_batch; |
| 226 | const uint32_t buf_size = para->buf_size; |
| 227 | struct rte_mbuf **srcs = para->srcs; |
| 228 | struct rte_mbuf **dsts = para->dsts; |
| 229 | uint16_t nr_cpl; |
| 230 | uint64_t async_cnt = 0; |
| 231 | uint32_t i; |
| 232 | uint32_t poll_cnt = 0; |
| 233 | int ret; |
| 234 | |
| 235 | worker_info->stop_flag = false; |
| 236 | worker_info->ready_flag = true; |
| 237 | |
| 238 | while (!worker_info->start_flag) |
| 239 | ; |
| 240 | |
| 241 | while (1) { |
| 242 | for (i = 0; i < nr_buf; i++) { |
| 243 | dma_copy: |
| 244 | ret = rte_dma_copy(dev_id, 0, rte_mbuf_data_iova(srcs[i]), |
| 245 | rte_mbuf_data_iova(dsts[i]), buf_size, 0); |
| 246 | if (unlikely(ret < 0)) { |
| 247 | if (ret == -ENOSPC) { |
| 248 | do_dma_submit_and_poll(dev_id, &async_cnt, worker_info); |
| 249 | goto dma_copy; |
| 250 | } else |
| 251 | error_exit(dev_id); |
| 252 | } |
| 253 | async_cnt++; |
| 254 | |
| 255 | if ((async_cnt % kick_batch) == 0) |
| 256 | do_dma_submit_and_poll(dev_id, &async_cnt, worker_info); |
| 257 | } |
| 258 | |
| 259 | if (worker_info->stop_flag) |
| 260 | break; |
| 261 | } |
| 262 | |
| 263 | rte_dma_submit(dev_id, 0); |
| 264 | while ((async_cnt > 0) && (poll_cnt++ < POLL_MAX)) { |
| 265 | nr_cpl = rte_dma_completed(dev_id, 0, MAX_DMA_CPL_NB, NULL, NULL); |
| 266 | async_cnt -= nr_cpl; |
| 267 | } |
| 268 | |
| 269 | return 0; |
| 270 | } |
| 271 | |
| 272 | static inline int |
| 273 | do_cpu_mem_copy(void *p) |
nothing calls this directly
no test coverage detected