Hi Robin, On 2023/2/2 21:43, Robin Jarry wrote: > Report the same information than rte_lcore_dump() in the telemetry > API into /eal/lcore/list and /eal/lcore/info,ID. > > Example: > > --> /eal/lcore/info,3 > { > "/eal/lcore/info": { > "lcore_id": 3, > "socket": 0, > "role": "RTE", > "cpuset": [ > 3 > ] > } > } >
... > + > +static int > +handle_lcore_info(const char *cmd __rte_unused, const char *params, struct > rte_tel_data *d) > +{ > + struct lcore_telemetry_info info = { .d = d }; > + unsigned long lcore_id; > + char *endptr; > + > + if (params == NULL) > + return -EINVAL; > + errno = 0; > + lcore_id = strtoul(params, &endptr, 10); > + if (errno) > + return -errno; > + if (*params == '\0' || *endptr != '\0' || lcore_id >= RTE_MAX_LCORE) > + return -EINVAL; > + > + info.lcore_id = lcore_id; > + > + return rte_lcore_iterate(lcore_telemetry_info_cb, &info); lcore_iterate will iterate and find the lcore. How about add one new API e.g. rte_lcore_cb(xxx) ? > +} > + > +RTE_INIT(lcore_telemetry) > +{ > + rte_telemetry_register_cmd( > + "/eal/lcore/list", handle_lcore_list, > + "List of lcore ids. Takes no parameters"); > + rte_telemetry_register_cmd( > + "/eal/lcore/info", handle_lcore_info, > + "Returns lcore info. Parameters: int lcore_id"); > +} > +#endif /* !RTE_EXEC_ENV_WINDOWS */ >