> > > +static int > > +security_handle_cryptodev_crypto_caps(const char *cmd __rte_unused, > > const char *params, > > + struct rte_tel_data *d) > > +{ > > + const struct rte_security_capability *capabilities; > > + struct rte_tel_data *crypto_caps; > > + const char *capa_param; > > + int dev_id, capa_id; > > + int crypto_caps_n; > > + char *end_param; > > + int rc; > > + > > + if (!params || strlen(params) == 0 || !isdigit(*params)) > > + return -EINVAL; > > + > > + dev_id = strtoul(params, &end_param, 0); > > + capa_param = strtok(end_param, ","); > > + if (!capa_param || strlen(capa_param) == 0 || > > !isdigit(*capa_param)) > > + return -EINVAL; > > + > > + capa_id = strtoul(capa_param, &end_param, 0); > > + if (*end_param != '\0') > > + CDEV_LOG_ERR("Extra parameters passed to command, > > ignoring"); > > + > > + rc = security_capabilities_from_dev_id(dev_id, (void *)&capabilities); > > + if (rc < 0) > > + return rc; > > + > > + crypto_caps = rte_tel_data_alloc(); > > + RTE_PTR_OR_ERR_RET(crypto_caps, -ENOMEM); > > + > > + rte_tel_data_start_dict(d); > > + crypto_caps_n = crypto_caps_array(crypto_caps, capabilities- > > >crypto_capabilities); > > + if (capa_id >= crypto_caps_n) { > > + CDEV_LOG_ERR("Extra parameters passed to command, > > ignoring"); > > + return -EINVAL; > > + } > > Something is not correct here. > Capa_id is not getting used properly. > Security_capabilities should be traversed until capa_id and then extract The > corresponding crypto capabilities. Right? > Yeah right. Fixing it.
Thanks, Gowrishankar > > > + > > + rte_tel_data_add_dict_container(d, "crypto_caps", crypto_caps, 0); > > + rte_tel_data_add_dict_int(d, "crypto_caps_n", crypto_caps_n); > > + > > + return 0; > > +} > > + > > +RTE_INIT(security_init_telemetry) > > +{ > > + rte_telemetry_register_cmd("/security/cryptodev/list", > > + security_handle_cryptodev_list, > > + "Returns list of available crypto devices by IDs. No > > parameters."); > > + > > + rte_telemetry_register_cmd("/security/cryptodev/sec_caps", > > + security_handle_cryptodev_sec_caps, > > + "Returns security capabilities for a cryptodev. Parameters: int > > dev_id"); > > + > > + rte_telemetry_register_cmd("/security/cryptodev/crypto_caps", > > + security_handle_cryptodev_crypto_caps, > > + "Returns crypto capabilities for a security capability. > > Parameters: int dev_id, sec_cap_id"); > > +} > > -- > > 2.25.1