return 1;
}
-static int parse_core_task(const char *str, uint32_t *lcore_id, uint32_t *task_id, unsigned int *nb_cores)
+static int parse_cores_task(const char *str, uint32_t *lcore_id, uint32_t *task_id, unsigned *nb_cores)
{
char str_lcore_id[128];
int ret;
return 0;
}
+static int parse_cores_tasks(const char *str, uint32_t *lcore_id, uint32_t *task_id, unsigned *nb_cores, unsigned *nb_tasks)
+{
+ char str_lcore_id[128], str_task_id[128];
+ int ret;
+
+ if (2 != sscanf(str, "%s %s", str_lcore_id, str_task_id))
+ return -1;
+
+ if ((ret = parse_list_set(lcore_id, str_lcore_id, RTE_MAX_LCORE)) <= 0) {
+ plog_err("Invalid core while parsing command (%s)\n", get_parse_err());
+ return -1;
+ }
+ *nb_cores = ret;
+
+ if ((ret = parse_list_set(task_id, str_task_id, MAX_TASKS_PER_CORE)) <= 0) {
+ plog_err("Invalid task while parsing command (%s)\n", get_parse_err());
+ return -1;
+ }
+ *nb_tasks = ret;
+
+ return 0;
+}
+
static const char *strchr_skip_twice(const char *str, int chr)
{
str = strchr(str, chr);
{
unsigned lcores[RTE_MAX_LCORE], task_id, nb_packets, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], task_id, nb_packets, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], task_id, nb_packets, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, count, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
float probability;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, delay_us, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, delay_us, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, pkt_size, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if ((prox_cfg.flags & DSF_ENABLE_BYPASS) == 0) {
plog_err("enable bypass not set => command not supported\n");
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, pkt_size, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
for (unsigned int i = 0; i < nb_cores; i++) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, pkt_size, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
float speed;
unsigned i;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
uint64_t bps;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
unsigned short offset;
uint8_t value_len;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
char rand_str[64];
int16_t rand_id = -1;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
for (unsigned int i = 0; i < nb_cores; i++) {
cmd_thread_info(lcores[i], task_id);
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
struct rte_ring *ring;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
struct rte_ring *ring;
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, ip[4], nb_cores, i;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, ip[4], nb_cores, i;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, prefix, next_hop_idx, ip[4], nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;
{
unsigned lcores[RTE_MAX_LCORE], task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
unsigned int i, c;
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
unsigned int i, c;
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
{
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
uint32_t val;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (cores_task_are_valid(lcores, task_id, nb_cores)) {
unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
uint32_t val;
- if (parse_core_task(str, lcores, &task_id, &nb_cores))
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
return -1;
if (!(str = strchr_skip_twice(str, ' ')))
return -1;