qp is lockless, should be accessed by only one thread */
| 783 | |
| 784 | /* qp is lockless, should be accessed by only one thread */ |
| 785 | static int |
| 786 | dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) |
| 787 | { |
| 788 | struct qman_fq *fq; |
| 789 | unsigned int pkts = 0; |
| 790 | int num_rx_bufs, ret; |
| 791 | struct qm_dqrr_entry *dq; |
| 792 | uint32_t vdqcr_flags = 0; |
| 793 | |
| 794 | fq = &qp->outq; |
| 795 | /* |
| 796 | * Until request for four buffers, we provide exact number of buffers. |
| 797 | * Otherwise we do not set the QM_VDQCR_EXACT flag. |
| 798 | * Not setting QM_VDQCR_EXACT flag can provide two more buffers than |
| 799 | * requested, so we request two less in this case. |
| 800 | */ |
| 801 | if (nb_ops < 4) { |
| 802 | vdqcr_flags = QM_VDQCR_EXACT; |
| 803 | num_rx_bufs = nb_ops; |
| 804 | } else { |
| 805 | num_rx_bufs = nb_ops > DPAA_MAX_DEQUEUE_NUM_FRAMES ? |
| 806 | (DPAA_MAX_DEQUEUE_NUM_FRAMES - 2) : (nb_ops - 2); |
| 807 | } |
| 808 | ret = qman_set_vdq(fq, num_rx_bufs, vdqcr_flags); |
| 809 | if (ret) |
| 810 | return 0; |
| 811 | |
| 812 | do { |
| 813 | const struct qm_fd *fd; |
| 814 | struct dpaa_sec_job *job; |
| 815 | struct dpaa_sec_op_ctx *ctx; |
| 816 | struct rte_crypto_op *op; |
| 817 | |
| 818 | dq = qman_dequeue(fq); |
| 819 | if (!dq) |
| 820 | continue; |
| 821 | |
| 822 | fd = &dq->fd; |
| 823 | /* sg is embedded in an op ctx, |
| 824 | * sg[0] is for output |
| 825 | * sg[1] for input |
| 826 | */ |
| 827 | job = rte_dpaa_mem_ptov(qm_fd_addr_get64(fd)); |
| 828 | |
| 829 | ctx = container_of(job, struct dpaa_sec_op_ctx, job); |
| 830 | ctx->fd_status = fd->status; |
| 831 | op = ctx->op; |
| 832 | if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) { |
| 833 | struct qm_sg_entry *sg_out; |
| 834 | uint32_t len; |
| 835 | struct rte_mbuf *mbuf = (op->sym->m_dst == NULL) ? |
| 836 | op->sym->m_src : op->sym->m_dst; |
| 837 | |
| 838 | sg_out = &job->sg[0]; |
| 839 | hw_sg_to_cpu(sg_out); |
| 840 | len = sg_out->length; |
| 841 | mbuf->pkt_len = len; |
| 842 | while (mbuf->next != NULL) { |
no test coverage detected