| 315 | } |
| 316 | |
| 317 | static int |
| 318 | capabilities_inspect(void) |
| 319 | { |
| 320 | struct crosscheck_testsuite_params *ts_params = &testsuite_params; |
| 321 | const struct rte_cryptodev_symmetric_capability *next_dev_cap; |
| 322 | struct rte_cryptodev_symmetric_capability common_cap; |
| 323 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 324 | const struct rte_cryptodev_capabilities *cap; |
| 325 | struct rte_cryptodev_info dev_info; |
| 326 | uint16_t nb_caps, cap_i = 0; |
| 327 | uint8_t cdev_id, i; |
| 328 | |
| 329 | /* Get list of capabilities of first device */ |
| 330 | cdev_id = ts_params->valid_devs[0]; |
| 331 | rte_cryptodev_info_get(cdev_id, &dev_info); |
| 332 | cap = dev_info.capabilities; |
| 333 | nb_caps = nb_sym_capabilities_get(cap); |
| 334 | common_symm_capas = rte_calloc(NULL, nb_caps, |
| 335 | sizeof(struct rte_cryptodev_symmetric_capability), 0); |
| 336 | if (common_symm_capas == NULL) |
| 337 | return -ENOMEM; |
| 338 | |
| 339 | for (; cap->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; cap++) { |
| 340 | /* Skip non symmetric capabilities */ |
| 341 | if (cap->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) |
| 342 | continue; |
| 343 | /* AES_CCM requires special handling due to api requirements, skip now */ |
| 344 | if (cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD && |
| 345 | cap->sym.aead.algo == RTE_CRYPTO_AEAD_AES_CCM) |
| 346 | continue; |
| 347 | |
| 348 | cap_idx = sym_capability_to_idx(&cap->sym); |
| 349 | common_cap = cap->sym; |
| 350 | for (i = 1; i < ts_params->valid_dev_count; i++) { |
| 351 | cdev_id = ts_params->valid_devs[i]; |
| 352 | next_dev_cap = rte_cryptodev_sym_capability_get(cdev_id, &cap_idx); |
| 353 | /* Capability not supported by one of devs, skip */ |
| 354 | if (next_dev_cap == NULL) |
| 355 | goto skip; |
| 356 | /* Check if capabilities have a common range of values */ |
| 357 | if (common_capability_set(&common_cap, next_dev_cap) != 0) |
| 358 | goto skip; |
| 359 | } |
| 360 | |
| 361 | /* If capability reach this point - it's support by all cryptodevs */ |
| 362 | common_symm_capas[cap_i++] = common_cap; |
| 363 | skip:; |
| 364 | } |
| 365 | nb_common_sym_caps = cap_i; |
| 366 | |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | static int |
| 371 | crosscheck_init(void) |
no test coverage detected