| 177 | } |
| 178 | |
| 179 | static int |
| 180 | cryptodev_fips_validate_app_init(void) |
| 181 | { |
| 182 | struct rte_cryptodev_config conf = {rte_socket_id(), 1, 0}; |
| 183 | struct rte_cryptodev_qp_conf qp_conf = {128, NULL}; |
| 184 | uint32_t nb_mbufs = UINT16_MAX / env.mbuf_data_room + 1; |
| 185 | int ret; |
| 186 | |
| 187 | if (env.self_test) { |
| 188 | ret = fips_dev_self_test(env.dev_id, env.broken_test_config); |
| 189 | if (ret < 0) { |
| 190 | rte_cryptodev_stop(env.dev_id); |
| 191 | rte_cryptodev_close(env.dev_id); |
| 192 | |
| 193 | return ret; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | ret = rte_cryptodev_configure(env.dev_id, &conf); |
| 198 | if (ret < 0) |
| 199 | return ret; |
| 200 | |
| 201 | ret = -ENOMEM; |
| 202 | env.mpool = rte_pktmbuf_pool_create("FIPS_MEMPOOL", nb_mbufs, |
| 203 | 0, 0, sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM + |
| 204 | env.mbuf_data_room, rte_socket_id()); |
| 205 | if (!env.mpool) |
| 206 | return ret; |
| 207 | |
| 208 | ret = cryptodev_fips_validate_app_sym_init(); |
| 209 | if (ret < 0) |
| 210 | goto error_exit; |
| 211 | |
| 212 | if (env.is_asym_test) { |
| 213 | ret = cryptodev_fips_validate_app_asym_init(); |
| 214 | if (ret < 0) |
| 215 | goto error_exit; |
| 216 | } |
| 217 | |
| 218 | qp_conf.mp_session = env.sym.sess_mpool; |
| 219 | |
| 220 | ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf, |
| 221 | rte_socket_id()); |
| 222 | if (ret < 0) |
| 223 | goto error_exit; |
| 224 | |
| 225 | ret = rte_cryptodev_start(env.dev_id); |
| 226 | if (ret < 0) |
| 227 | goto error_exit; |
| 228 | |
| 229 | return 0; |
| 230 | |
| 231 | error_exit: |
| 232 | rte_mempool_free(env.mpool); |
| 233 | return ret; |
| 234 | } |
| 235 | |
| 236 | static void |
no test coverage detected