| 2650 | } |
| 2651 | |
| 2652 | int |
| 2653 | process_ops_to_enqueue(struct ccp_qp *qp, |
| 2654 | struct rte_crypto_op **op, |
| 2655 | struct ccp_queue *cmd_q, |
| 2656 | uint16_t nb_ops, |
| 2657 | uint16_t total_nb_ops, |
| 2658 | int slots_req, |
| 2659 | uint16_t b_idx) |
| 2660 | { |
| 2661 | int i, result = 0; |
| 2662 | struct ccp_batch_info *b_info; |
| 2663 | struct ccp_session *session; |
| 2664 | EVP_MD_CTX *auth_ctx = NULL; |
| 2665 | |
| 2666 | if (rte_mempool_get(qp->batch_mp, (void **)&b_info)) { |
| 2667 | CCP_LOG_ERR("batch info allocation failed"); |
| 2668 | return 0; |
| 2669 | } |
| 2670 | |
| 2671 | auth_ctx = EVP_MD_CTX_create(); |
| 2672 | if (unlikely(!auth_ctx)) { |
| 2673 | CCP_LOG_ERR("Unable to create auth ctx"); |
| 2674 | return 0; |
| 2675 | } |
| 2676 | b_info->auth_ctr = 0; |
| 2677 | |
| 2678 | /* populate batch info necessary for dequeue */ |
| 2679 | b_info->op_idx = 0; |
| 2680 | b_info->b_idx = 0; |
| 2681 | b_info->lsb_buf_idx = 0; |
| 2682 | b_info->desccnt = 0; |
| 2683 | b_info->cmd_q = cmd_q; |
| 2684 | b_info->lsb_buf_phys = (phys_addr_t)rte_mem_virt2iova((void *)b_info->lsb_buf); |
| 2685 | |
| 2686 | rte_atomic64_sub(&b_info->cmd_q->free_slots, slots_req); |
| 2687 | |
| 2688 | b_info->head_offset = (uint32_t)(cmd_q->qbase_phys_addr + cmd_q->qidx * |
| 2689 | Q_DESC_SIZE); |
| 2690 | for (i = b_idx; i < (nb_ops+b_idx); i++) { |
| 2691 | session = CRYPTODEV_GET_SYM_SESS_PRIV(op[i]->sym->session); |
| 2692 | switch (session->cmd_id) { |
| 2693 | case CCP_CMD_CIPHER: |
| 2694 | result = ccp_crypto_cipher(op[i], cmd_q, b_info); |
| 2695 | break; |
| 2696 | case CCP_CMD_AUTH: |
| 2697 | if (session->auth_opt) { |
| 2698 | b_info->auth_ctr++; |
| 2699 | result = cpu_crypto_auth(qp, op[i], |
| 2700 | session, auth_ctx); |
| 2701 | } else |
| 2702 | result = ccp_crypto_auth(op[i], cmd_q, b_info); |
| 2703 | break; |
| 2704 | case CCP_CMD_CIPHER_HASH: |
| 2705 | result = ccp_crypto_cipher(op[i], cmd_q, b_info); |
| 2706 | if (result) |
| 2707 | break; |
| 2708 | result = ccp_crypto_auth(op[i], cmd_q, b_info); |
| 2709 | break; |
no test coverage detected