int task_is_mode_and_submode(uint32_t lcore_id, uint32_t task_id, const char *mode, const char *sub_mode)
{
- struct task_init *t = lcore_cfg[lcore_id].targs[task_id].task_init;
+ struct task_args *targs = &lcore_cfg[lcore_id].targs[task_id];
- return !strcmp(t->mode_str, mode) && !strcmp(t->sub_mode_str, sub_mode);
+ return !strcmp(targs->task_init->mode_str, mode) && !strcmp(targs->sub_mode_str, sub_mode);
}
int task_is_mode(uint32_t lcore_id, uint32_t task_id, const char *mode)
int task_is_sub_mode(uint32_t lcore_id, uint32_t task_id, const char *sub_mode)
{
- struct task_init *t = lcore_cfg[lcore_id].targs[task_id].task_init;
+ struct task_args *targs = &lcore_cfg[lcore_id].targs[task_id];
- return !strcmp(t->sub_mode_str, sub_mode);
+ return !strcmp(targs->sub_mode_str, sub_mode);
}
static void log_pkt_count(uint32_t count, uint32_t lcore_id, uint32_t task_id)
lcore_id = lcores[i];
if ((!task_is_mode_and_submode(lcore_id, task_id, "impair", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "impair", "l3"))){
plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id);
- return -1;
+ } else {
+ struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
+ task_impair_set_proba(tbase, probability);
}
- struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
- task_impair_set_proba(tbase, probability);
}
}
return 0;
lcore_id = lcores[i];
if ((!task_is_mode_and_submode(lcore_id, task_id, "impair", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "impair", "l3"))){
plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id);
- return -1;
+ } else {
+ struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
+ task_impair_set_delay_us(tbase, delay_us, 0);
}
- struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
- task_impair_set_delay_us(tbase, delay_us, 0);
}
}
return 0;
lcore_id = lcores[i];
if ((!task_is_mode_and_submode(lcore_id, task_id, "impair", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "impair", "l3"))){
plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id);
- return -1;
+ } else {
+ struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
+ task_impair_set_delay_us(tbase, 0, delay_us);
}
- struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
- task_impair_set_delay_us(tbase, 0, delay_us);
}
}
return 0;
lcore_id = lcores[i];
if ((!task_is_mode_and_submode(lcore_id, task_id, "gen", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "gen", "l3"))) {
plog_err("Core %u task %u is not generating packets\n", lcore_id, task_id);
+ } else {
+ struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
+ task_gen_set_pkt_size(tbase, pkt_size); /* error printed within function */
}
- struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
-
- if (task_gen_set_pkt_size(tbase, pkt_size) != 0)
- return -1;
}
}
return 0;
if ((!task_is_mode_and_submode(lcore_id, task_id, "gen", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "gen", "l3"))) {
plog_err("Core %u task %u is not generating packets\n", lcore_id, task_id);
}
- else if (speed > 400.0f || speed < 0.0f) {
- plog_err("Speed out of range (must be betweeen 0%% and 100%%)\n");
+ else if (speed > 1000.0f || speed < 0.0f) { // Up to 100 Gbps
+ plog_err("Speed out of range (must be betweeen 0%% and 1000%%)\n");
}
else {
struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];
if ((!task_is_mode_and_submode(lcore_id, task_id, "gen", "")) && (!task_is_mode_and_submode(lcore_id, task_id, "gen", "l3"))) {
plog_err("Core %u task %u is not generating packets\n", lcore_id, task_id);
}
- else if (bps > 1250000000) {
- plog_err("Speed out of range (must be <= 1250000000)\n");
+ else if (bps > 12500000000) { // Up to 100Gbps
+ plog_err("Speed out of range (must be <= 12500000000)\n");
}
else {
struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id];