From 7c4601f23c526b14a67674782b303663dfaa95af Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Fri, 3 Jan 2020 03:09:19 +0100 Subject: 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 --- VNFs/DPPD-PROX/prox_args.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'VNFs/DPPD-PROX/prox_args.c') diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c index cb0dcb31..cc8b3b25 100644 --- a/VNFs/DPPD-PROX/prox_args.c +++ b/VNFs/DPPD-PROX/prox_args.c @@ -1009,6 +1009,34 @@ static int get_core_cfg(unsigned sindex, char *str, void *data) if (STR_EQ(str, "pcap file")) { return parse_str(targ->pcap_file, pkey, sizeof(targ->pcap_file)); } + if (STR_EQ(str, "imix")) { + char pkey2[MAX_CFG_STRING_LEN], *ptr; + if (parse_str(pkey2, pkey, sizeof(pkey2)) != 0) { + set_errf("Error while parsing imix, too long\n"); + return -1; + } + const size_t pkey_len = strlen(pkey2); + targ->imix_nb_pkts = 0; + ptr = pkey2; + while (targ->imix_nb_pkts < MAX_IMIX_PKTS) { + if (parse_int(&targ->imix_pkt_sizes[targ->imix_nb_pkts], ptr) != 0) + break; + targ->imix_nb_pkts++; + if ((ptr = strchr(ptr, ',')) == NULL) + break; + ptr++; + if (targ->imix_nb_pkts == MAX_IMIX_PKTS) { + set_errf("Too many packet sizes specified"); + return -1; + } + } + plog_info("%d IMIX packets:", targ->imix_nb_pkts); + for (size_t i = 0; i < targ->imix_nb_pkts; ++i) { + plog_info("%d ", targ->imix_pkt_sizes[i]); + } + plog_info("\n"); + return 0; + } if (STR_EQ(str, "pkt inline")) { char pkey2[MAX_CFG_STRING_LEN]; if (parse_str(pkey2, pkey, sizeof(pkey2)) != 0) { -- cgit 1.2.3-korg