| 367 | }; |
| 368 | |
| 369 | static int |
| 370 | vhost_crypto_worker(void *arg) |
| 371 | { |
| 372 | struct rte_crypto_op *ops[NB_VIRTIO_QUEUES][MAX_PKT_BURST + 1]; |
| 373 | struct rte_crypto_op *ops_deq[NB_VIRTIO_QUEUES][MAX_PKT_BURST + 1]; |
| 374 | struct vhost_crypto_info *info = arg; |
| 375 | uint16_t nb_callfds; |
| 376 | int callfds[VIRTIO_CRYPTO_MAX_NUM_BURST_VQS]; |
| 377 | uint32_t lcore_id = rte_lcore_id(); |
| 378 | uint32_t burst_size = MAX_PKT_BURST; |
| 379 | uint32_t i, j, k; |
| 380 | uint32_t to_fetch, fetched; |
| 381 | |
| 382 | int ret = 0; |
| 383 | |
| 384 | RTE_LOG(INFO, USER1, "Processing on Core %u started\n", lcore_id); |
| 385 | |
| 386 | for (i = 0; i < NB_VIRTIO_QUEUES; i++) { |
| 387 | if (rte_crypto_op_bulk_alloc(info->cop_pool, |
| 388 | RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops[i], |
| 389 | burst_size) < burst_size) { |
| 390 | RTE_LOG(ERR, USER1, "Failed to alloc cops\n"); |
| 391 | ret = -1; |
| 392 | goto exit; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | while (1) { |
| 397 | for (i = 0; i < info->nb_vids; i++) { |
| 398 | if (unlikely(info->initialized[i] == 0)) |
| 399 | continue; |
| 400 | |
| 401 | for (j = 0; j < NB_VIRTIO_QUEUES; j++) { |
| 402 | to_fetch = RTE_MIN(burst_size, |
| 403 | (NB_CRYPTO_DESCRIPTORS - |
| 404 | info->nb_inflight_ops)); |
| 405 | fetched = rte_vhost_crypto_fetch_requests( |
| 406 | info->vids[i], j, ops[j], |
| 407 | to_fetch); |
| 408 | info->nb_inflight_ops += |
| 409 | rte_cryptodev_enqueue_burst( |
| 410 | info->cid, info->qid, ops[j], |
| 411 | fetched); |
| 412 | if (unlikely(rte_crypto_op_bulk_alloc( |
| 413 | info->cop_pool, |
| 414 | RTE_CRYPTO_OP_TYPE_SYMMETRIC, |
| 415 | ops[j], fetched) < fetched)) { |
| 416 | RTE_LOG(ERR, USER1, "Failed realloc\n"); |
| 417 | return -1; |
| 418 | } |
| 419 | |
| 420 | fetched = rte_cryptodev_dequeue_burst( |
| 421 | info->cid, info->qid, |
| 422 | ops_deq[j], RTE_MIN(burst_size, |
| 423 | info->nb_inflight_ops)); |
| 424 | fetched = rte_vhost_crypto_finalize_requests( |
| 425 | ops_deq[j], fetched, callfds, |
| 426 | &nb_callfds); |
nothing calls this directly
no test coverage detected