Process crypto operation for mbuf */
| 3269 | |
| 3270 | /** Process crypto operation for mbuf */ |
| 3271 | static int |
| 3272 | process_op(struct openssl_qp *qp, struct rte_crypto_op *op, |
| 3273 | struct openssl_session *sess) |
| 3274 | { |
| 3275 | struct rte_mbuf *msrc, *mdst; |
| 3276 | int retval; |
| 3277 | |
| 3278 | msrc = op->sym->m_src; |
| 3279 | mdst = op->sym->m_dst ? op->sym->m_dst : op->sym->m_src; |
| 3280 | |
| 3281 | op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; |
| 3282 | |
| 3283 | switch (sess->chain_order) { |
| 3284 | case OPENSSL_CHAIN_ONLY_CIPHER: |
| 3285 | process_openssl_cipher_op(qp, op, sess, msrc, mdst); |
| 3286 | break; |
| 3287 | case OPENSSL_CHAIN_ONLY_AUTH: |
| 3288 | process_openssl_auth_op(qp, op, sess, msrc, mdst); |
| 3289 | break; |
| 3290 | case OPENSSL_CHAIN_CIPHER_AUTH: |
| 3291 | process_openssl_cipher_op(qp, op, sess, msrc, mdst); |
| 3292 | /* OOP */ |
| 3293 | if (msrc != mdst) |
| 3294 | copy_plaintext(msrc, mdst, op); |
| 3295 | process_openssl_auth_op(qp, op, sess, mdst, mdst); |
| 3296 | break; |
| 3297 | case OPENSSL_CHAIN_AUTH_CIPHER: |
| 3298 | process_openssl_auth_op(qp, op, sess, msrc, mdst); |
| 3299 | process_openssl_cipher_op(qp, op, sess, msrc, mdst); |
| 3300 | break; |
| 3301 | case OPENSSL_CHAIN_COMBINED: |
| 3302 | process_openssl_combined_op(qp, op, sess, msrc, mdst); |
| 3303 | break; |
| 3304 | case OPENSSL_CHAIN_CIPHER_BPI: |
| 3305 | process_openssl_docsis_bpi_op(op, sess, msrc, mdst); |
| 3306 | break; |
| 3307 | default: |
| 3308 | op->status = RTE_CRYPTO_OP_STATUS_ERROR; |
| 3309 | break; |
| 3310 | } |
| 3311 | |
| 3312 | /* Free session if a session-less crypto op */ |
| 3313 | if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { |
| 3314 | openssl_reset_session(sess); |
| 3315 | memset(sess, 0, sizeof(struct openssl_session)); |
| 3316 | rte_mempool_put(qp->sess_mp, op->sym->session); |
| 3317 | op->sym->session = NULL; |
| 3318 | } |
| 3319 | |
| 3320 | if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) |
| 3321 | op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; |
| 3322 | |
| 3323 | if (op->status != RTE_CRYPTO_OP_STATUS_ERROR) |
| 3324 | retval = rte_ring_enqueue(qp->processed_ops, (void *)op); |
| 3325 | else |
| 3326 | retval = -1; |
| 3327 | |
| 3328 | return retval; |
no test coverage detected