From ace499fbbdd44cbb9c0d68d6aad40e0b280d54de Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Thu, 2 Jul 2020 10:02:40 +0200 Subject: Added support for reporting packet (mis)order. The "Latency" screen has been updated with 3 columns: - mis-ordered Count the number of mis-ordered packets. - extent: Gives an indication of how mis-ordered the packets are. Receiving packet "x - 5" after receiving packet "x" will cause an extent of 5. - duplicate: Count number of duplicate packets. Following commands have been added for the impair mode: - proba no drop: replaces the former "probability" command. Percentage of forwarded packets. So 99.5 means 0.5% of packet drop. - proba delay Percentage of delayed packets for the impair mode. - proba duplicate Percentage of duplicate packets. Similar parameters are supported within the config files: - proba no drop - proba delay - proba duplicate Note: it is recommanded to use the signature when measuring packet misorder, as otherwise unexpected packet would cause miscounts. Change-Id: I037f606f264d6e2bd7f123df5ed57ab7df8386d7 Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/cmd_parser.c | 67 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) (limited to 'VNFs/DPPD-PROX/cmd_parser.c') diff --git a/VNFs/DPPD-PROX/cmd_parser.c b/VNFs/DPPD-PROX/cmd_parser.c index 2d3b5704..51a71f48 100644 --- a/VNFs/DPPD-PROX/cmd_parser.c +++ b/VNFs/DPPD-PROX/cmd_parser.c @@ -398,16 +398,16 @@ static int parse_cmd_count(const char *str, struct input *input) return 0; } -static int parse_cmd_set_probability(const char *str, struct input *input) +static int parse_cmd_set_proba_no_drop(const char *str, struct input *input) { unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores; - float probability; + float proba_no_drop; if (parse_cores_task(str, lcores, &task_id, &nb_cores)) return -1; if (!(str = strchr_skip_twice(str, ' '))) return -1; - if (sscanf(str, "%f", &probability) != 1) + if (sscanf(str, "%f", &proba_no_drop) != 1) return -1; if (cores_task_are_valid(lcores, task_id, nb_cores)) { @@ -417,7 +417,59 @@ static int parse_cmd_set_probability(const char *str, struct input *input) plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id); } else { struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id]; - task_impair_set_proba(tbase, probability); + task_impair_set_proba_no_drop(tbase, proba_no_drop); + } + } + } + return 0; +} + +static int parse_cmd_set_proba_delay(const char *str, struct input *input) +{ + unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores; + float proba_delay; + + if (parse_cores_task(str, lcores, &task_id, &nb_cores)) + return -1; + if (!(str = strchr_skip_twice(str, ' '))) + return -1; + if (sscanf(str, "%f", &proba_delay) != 1) + return -1; + + if (cores_task_are_valid(lcores, task_id, nb_cores)) { + for (unsigned int i = 0; i < nb_cores; i++) { + lcore_id = lcores[i]; + if (!task_is_mode(lcore_id, task_id, "impair")) { + plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id); + } else { + struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id]; + task_impair_set_proba_delay(tbase, proba_delay); + } + } + } + return 0; +} + +static int parse_cmd_set_proba_duplicate(const char *str, struct input *input) +{ + unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores; + float proba_duplicate; + + if (parse_cores_task(str, lcores, &task_id, &nb_cores)) + return -1; + if (!(str = strchr_skip_twice(str, ' '))) + return -1; + if (sscanf(str, "%f", &proba_duplicate) != 1) + return -1; + + if (cores_task_are_valid(lcores, task_id, nb_cores)) { + for (unsigned int i = 0; i < nb_cores; i++) { + lcore_id = lcores[i]; + if (!task_is_mode(lcore_id, task_id, "impair")) { + plog_err("Core %u task %u is not impairing packets\n", lcore_id, task_id); + } else { + struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id]; + task_impair_set_proba_duplicate(tbase, proba_duplicate); } } } @@ -2240,7 +2292,12 @@ static struct cmd_str cmd_strings[] = { {"cgnat dump private hash", " ", "Dump cgnat private hash table", parse_cmd_cgnat_private_hash}, {"delay_us", " ", "Set the delay in usec for the impair mode to ", parse_cmd_delay_us}, {"random delay_us", " ", "Set the delay in usec for the impair mode to ", parse_cmd_random_delay_us}, - {"probability", " ", "Set the percent of forwarded packets for the impair mode", parse_cmd_set_probability}, + {"probability", " ", "Old - Use instead. Set the percent of forwarded packets for the impair mode", parse_cmd_set_proba_no_drop}, // old - backward compatibility + {"proba no drop", " ", "Set the percent of forwarded packets for the impair mode", parse_cmd_set_proba_no_drop}, + {"proba delay", " ", "Set the percent of delayed packets for the impair mode", parse_cmd_set_proba_delay}, +#if RTE_VERSION >= RTE_VERSION_NUM(19,11,0,0) + {"proba duplicate", " ", "Set the percent of duplicate packets for the impair mode", parse_cmd_set_proba_duplicate}, +#endif {"version", "", "Show version", parse_cmd_version}, {"join igmp", " ", "Send igmp membership report for group ", parse_cmd_join_igmp}, {"leave igmp", " ", "Send igmp leave group", parse_cmd_leave_igmp}, -- cgit 1.2.3-korg