| 487 | } |
| 488 | |
| 489 | static int |
| 490 | security_handle_cryptodev_crypto_caps(const char *cmd __rte_unused, const char *params, |
| 491 | struct rte_tel_data *d) |
| 492 | { |
| 493 | const struct rte_security_capability *capabilities; |
| 494 | struct rte_tel_data *crypto_caps; |
| 495 | const char *capa_param; |
| 496 | int dev_id, capa_id; |
| 497 | int crypto_caps_n; |
| 498 | char *end_param; |
| 499 | int rc; |
| 500 | |
| 501 | if (!params || strlen(params) == 0 || !isdigit(*params)) |
| 502 | return -EINVAL; |
| 503 | |
| 504 | dev_id = strtoul(params, &end_param, 0); |
| 505 | capa_param = strtok(end_param, ","); |
| 506 | if (!capa_param || strlen(capa_param) == 0 || !isdigit(*capa_param)) |
| 507 | return -EINVAL; |
| 508 | |
| 509 | capa_id = strtoul(capa_param, &end_param, 0); |
| 510 | if (*end_param != '\0') |
| 511 | CDEV_LOG_ERR("Extra parameters passed to command, ignoring"); |
| 512 | |
| 513 | rc = security_capabilities_from_dev_id(dev_id, (void *)&capabilities); |
| 514 | if (rc < 0) |
| 515 | return rc; |
| 516 | |
| 517 | capabilities = security_capability_by_index(capabilities, capa_id); |
| 518 | RTE_PTR_OR_ERR_RET(capabilities, -EINVAL); |
| 519 | |
| 520 | crypto_caps = rte_tel_data_alloc(); |
| 521 | RTE_PTR_OR_ERR_RET(crypto_caps, -ENOMEM); |
| 522 | |
| 523 | rte_tel_data_start_dict(d); |
| 524 | crypto_caps_n = crypto_caps_array(crypto_caps, capabilities->crypto_capabilities); |
| 525 | |
| 526 | rte_tel_data_add_dict_container(d, "crypto_caps", crypto_caps, 0); |
| 527 | rte_tel_data_add_dict_int(d, "crypto_caps_n", crypto_caps_n); |
| 528 | |
| 529 | return 0; |
| 530 | } |
| 531 | |
| 532 | RTE_INIT(security_init_telemetry) |
| 533 | { |
nothing calls this directly
no test coverage detected