| 751 | } |
| 752 | |
| 753 | static int |
| 754 | single_dev_process(const struct crosscheck_test_profile *profile, uint16_t dev_id, enum |
| 755 | crypto_op_type op_type, const uint8_t *input_buf, uint16_t input_len, |
| 756 | uint8_t *output_buf, uint16_t *output_len) |
| 757 | { |
| 758 | struct rte_cryptodev_sym_session *session = NULL; |
| 759 | struct rte_mbuf *ibuf = NULL, *obuf = NULL; |
| 760 | struct rte_crypto_op *op = NULL; |
| 761 | int ret = -1; |
| 762 | |
| 763 | session = session_create(profile, dev_id, op_type); |
| 764 | if (session == NULL) |
| 765 | goto error; |
| 766 | |
| 767 | ibuf = mbuf_create(input_buf, input_len); |
| 768 | if (ibuf == NULL) |
| 769 | goto error; |
| 770 | |
| 771 | op = operation_create(profile, ibuf, op_type); |
| 772 | if (op == NULL) |
| 773 | goto error; |
| 774 | |
| 775 | debug_hexdump(stdout, "Input:", rte_pktmbuf_mtod(ibuf, uint8_t*), ibuf->pkt_len); |
| 776 | |
| 777 | rte_crypto_op_attach_sym_session(op, session); |
| 778 | |
| 779 | struct rte_crypto_op *res = crypto_request_process(dev_id, op); |
| 780 | if (res == NULL) |
| 781 | goto error; |
| 782 | |
| 783 | obuf = op->sym->m_src; |
| 784 | if (obuf == NULL) { |
| 785 | RTE_LOG(ERR, USER1, "Invalid packet received\n"); |
| 786 | goto error; |
| 787 | } |
| 788 | mbuf_to_buf_copy(obuf, output_buf, output_len); |
| 789 | |
| 790 | ret = 0; |
| 791 | |
| 792 | error: |
| 793 | if (session != NULL) { |
| 794 | int sret; |
| 795 | sret = rte_cryptodev_sym_session_free(dev_id, session); |
| 796 | RTE_VERIFY(sret == 0); |
| 797 | } |
| 798 | rte_pktmbuf_free(ibuf); |
| 799 | rte_crypto_op_free(op); |
| 800 | return ret; |
| 801 | } |
| 802 | |
| 803 | static int |
| 804 | buffers_compare(const uint8_t *expected, uint16_t expected_len, |
no test coverage detected