summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/cmd_parser.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2020-01-03 03:09:19 +0100
committerXavier Simonart <xavier.simonart@intel.com>2020-05-29 23:41:49 +0200
commit7c4601f23c526b14a67674782b303663dfaa95af (patch)
tree51915ce3a919e03b67dbcc4c4dafa70bbd358eab /VNFs/DPPD-PROX/cmd_parser.c
parentc61fccde40dc6bb4a6ecd21c9d6dc8969df33400 (diff)
Added support for IMIX through config and command line
In Prox configuration IMIX can be specified using the following syntax: imix=pkt_size,pkt_size... Up to 127 different pkt sizes can be specified. Through command line, the following syntax can be used imix core_id task_id pkt_size,pkt_size... Up to 127 packet sizes can be specified. When IMIX is enabled, PROX will loop through the list of packet sizes. PROX supports two different submodes to handle pcap files. In the 1st submode (default, no submode specified), timestamps from the pcap file are ignored. In this submode IMIX is supported as well and each packets in the pcap file will be generated with all IMIX sizes. In the second submode, called pcap in gen mode, packets are generated at the timestamp specified in the pcap file. This submode does not support IMIX. Change-Id: I53cbf1378a5364254285b81e6848350d98561184 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/cmd_parser.c')
-rw-r--r--VNFs/DPPD-PROX/cmd_parser.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/cmd_parser.c b/VNFs/DPPD-PROX/cmd_parser.c
index 0dd173f3..8c72f7bf 100644
--- a/VNFs/DPPD-PROX/cmd_parser.c
+++ b/VNFs/DPPD-PROX/cmd_parser.c
@@ -536,6 +536,47 @@ static int parse_cmd_pkt_size(const char *str, struct input *input)
return 0;
}
+static int parse_cmd_imix(const char *str, struct input *input)
+{
+ unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores;
+ uint32_t pkt_sizes[MAX_IMIX_PKTS], tmp;
+ uint32_t pkt_index = 0;
+
+ if (parse_cores_task(str, lcores, &task_id, &nb_cores))
+ return -1;
+ if (!(str = strchr_skip_twice(str, ' ')))
+ return -1;
+ while (pkt_index < MAX_IMIX_PKTS) {
+ if (sscanf(str, "%d", &pkt_sizes[pkt_index]) != 1)
+ break;
+ pkt_index++;
+ if ((str = strchr(str, ',')) == NULL)
+ break;
+ str = str + 1;
+ }
+ if (pkt_index == 0) {
+ plog_err("No pkt size found\n");
+ return -1;
+ }
+ if ((pkt_index == MAX_IMIX_PKTS) && (str) && (sscanf(str, "%d", &tmp) == 1)) {
+ plog_err("Too many inputs - unexpected inputs starting at %s\n", str);
+ 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_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_imix(tbase, pkt_index, pkt_sizes); /* error printed within function */
+ }
+ }
+ }
+ return 0;
+}
+
static int parse_cmd_speed(const char *str, struct input *input)
{
unsigned lcores[RTE_MAX_LCORE], task_id, lcore_id, nb_cores;
@@ -2143,6 +2184,7 @@ static struct cmd_str cmd_strings[] = {
{"bypass", "<core_id> <task_id>", "Bypass task", parse_cmd_bypass},
{"reconnect", "<core_id> <task_id>", "Reconnect task", parse_cmd_reconnect},
{"pkt_size", "<core_id> <task_id> <pkt_size>", "Set the packet size to <pkt_size>", parse_cmd_pkt_size},
+ {"imix", "<core_id> <task_id> <pkt_size,pkt_size ... >", "Set the packet sizes to <pkt_size>", parse_cmd_imix},
{"speed", "<core_id> <task_id> <speed percentage>", "Change the speed to <speed percentage> at which packets are being generated on core <core_id> in task <task_id>.", parse_cmd_speed},
{"speed_byte", "<core_id> <task_id> <speed>", "Change speed to <speed>. The speed is specified in units of bytes per second.", parse_cmd_speed_byte},
{"set value", "<core_id> <task_id> <offset> <value> <value_len>", "Set <value_len> bytes to <value> at offset <offset> in packets generated on <core_id> <task_id>", parse_cmd_set_value},