Preparation for packet mis-ordering stats 27/72127/5
authorLuc Provoost <luc.provoost@intel.com>
Wed, 24 Feb 2021 10:51:22 +0000 (11:51 +0100)
committerLuc Provoost <luc.provoost@intel.com>
Thu, 25 Feb 2021 21:09:17 +0000 (21:09 +0000)
Changed PROX and the python scripts so that the "lat all stats" command
also returns the mis_ordered, extent and duplicate statistics.
In order to make this work properly, we need now to also stop and
restart the latency cores, every time we stop and start the generator
cores, since the sequence numbers are reinitialised every time we start
the generator core.

Change-Id: Ic4212a989c8ee9d0f026a34ca63a08b982c32b71
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
VNFs/DPPD-PROX/cmd_parser.c
VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py

index 7d216ba..0973a4e 100644 (file)
@@ -1880,7 +1880,7 @@ static void handle_lat_stats(unsigned lcore_id, unsigned task_id, struct input *
        if (input->reply) {
                char buf[128];
                snprintf(buf, sizeof(buf),
-                        "%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%u,%u\n",
+                        "%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%u,%u,%"PRIu64",%"PRIu64",%"PRIu64"\n",
                         lat_min_usec,
                         lat_max_usec,
                         lat_avg_usec,
@@ -1889,18 +1889,24 @@ static void handle_lat_stats(unsigned lcore_id, unsigned task_id, struct input *
                         last_tsc,
                         rte_get_tsc_hz(),
                         lcore_id,
-                        task_id);
+                        task_id,
+                        stats->mis_ordered,
+                        stats->extent,
+                        stats->duplicate);
                input->reply(input, buf, strlen(buf));
        }
        else {
-               plog_info("core: %u, task: %u, min: %"PRIu64", max: %"PRIu64", avg: %"PRIu64", min since reset: %"PRIu64", max since reset: %"PRIu64"\n",
-                         lcore_id,
-                         task_id,
-                         lat_min_usec,
-                         lat_max_usec,
-                         lat_avg_usec,
-                         tot_lat_min_usec,
-                         tot_lat_max_usec);
+               plog_info("core: %u, task: %u, min: %"PRIu64", max: %"PRIu64", avg: %"PRIu64", min since reset: %"PRIu64", max since reset: %"PRIu64", mis_ordered: %"PRIu64", extent: %"PRIu64", duplicates: %"PRIu64"\n",
+                        lcore_id,
+                        task_id,
+                        lat_min_usec,
+                        lat_max_usec,
+                        lat_avg_usec,
+                        tot_lat_min_usec,
+                        tot_lat_max_usec,
+                        stats->mis_ordered,
+                        stats->extent,
+                        stats->duplicate);
        }
 }
 
index 5fc98db..7c598eb 100644 (file)
@@ -230,6 +230,9 @@ class prox_sock(object):
             hz = int(stats[6])
             #coreid = int(stats[7])
             #taskid = int(stats[8])
+            mis_ordered = int(stats[9])
+            extent = int(stats[10])
+            duplicate = int(stats[11])
             stats = self._recv().split(':')
             if stats[0].startswith('error'):
                 RapidLog.critical("lat stats error: unexpected lat bucket \
index d5d5e4f..042fc8d 100644 (file)
@@ -98,7 +98,6 @@ class FlowSizeTest(RapidTest):
 
     def run(self):
         result_details = {'Details': 'Nothing'}
-        self.gen_machine.start_latency_cores()
         TestResult = 0
         for imix in self.test['imixs']:
             size = mean(imix)
index 074d4f7..9f1af50 100644 (file)
@@ -74,6 +74,10 @@ class RapidGeneratorMachine(RapidMachine):
         self.udp_dest_port_offset = udp_header_start_offset + 2
         self.udp_length_offset = udp_header_start_offset + 4
         self.ipv6 = ipv6
+        if 'bucket_size_exp' in machine_params.keys():
+            self.bucket_size_exp = machine_params['bucket_size_exp']
+        else:
+            self.bucket_size_exp = 11
         super().__init__(key, user, vim, rundir, resultsdir, machine_params,
                 configonly)
 
@@ -99,7 +103,7 @@ class RapidGeneratorMachine(RapidMachine):
             RapidLog.debug('{} ({}): latcores {} remapped to {}'.format(self.name, self.ip, self.machine_params['latcores'], cpus_remapped))
             self.machine_params['latcores'] = cpus_remapped
 
-    def generate_lua(self, vim, prox_config_file):
+    def generate_lua(self):
         appendix = 'gencores="%s"\n'% ','.join(map(str,
             self.machine_params['gencores']))
         appendix = appendix + 'latcores="%s"\n'% ','.join(map(str,
@@ -110,10 +114,6 @@ class RapidGeneratorMachine(RapidMachine):
                 appendix = appendix + 'gw_ip{}="{}"\n'.format(index, gw_ip)
                 appendix = (appendix + 'gw_hex_ip{}=convertIPToHex(gw_ip{})\n'.
                         format(index, index))
-        if 'bucket_size_exp' in self.machine_params.keys():
-            self.bucket_size_exp = self.machine_params['bucket_size_exp']
-        else:
-            self.bucket_size_exp = 11
         appendix = (appendix +
                 'bucket_size_exp="{}"\n'.format(self.bucket_size_exp))
         if 'heartbeat' in self.machine_params.keys():
@@ -121,7 +121,7 @@ class RapidGeneratorMachine(RapidMachine):
                     'heartbeat="%s"\n'% self.machine_params['heartbeat'])
         else:
             appendix = appendix + 'heartbeat="60"\n'
-        super().generate_lua(vim, prox_config_file, appendix)
+        super().generate_lua(appendix)
 
     def start_prox(self):
         # Start the generator with the -e option so that the cores don't
index fb96760..e97b255 100644 (file)
@@ -50,6 +50,10 @@ class RapidMachine(object):
         self.machine_params = machine_params
         self.vim = vim
         self.cpu_mapping = None
+        PROXConfigfile =  open (self.machine_params['config_file'], 'r')
+        PROXConfig = PROXConfigfile.read()
+        PROXConfigfile.close()
+        self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",PROXConfig))
 
     def __del__(self):
         if ((not self.configonly) and self.machine_params['prox_socket']):
@@ -127,11 +131,7 @@ class RapidMachine(object):
                 result = self._client.run_cmd(DevBindFileName)
                 RapidLog.debug('devbind.sh running for port {} on {} {}'.format(index, self.name, result))
 
-    def generate_lua(self, vim, prox_config_file, appendix = ''):
-        PROXConfigfile =  open (prox_config_file, 'r')
-        PROXConfig = PROXConfigfile.read()
-        PROXConfigfile.close()
-        self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",PROXConfig))
+    def generate_lua(self, appendix = ''):
         self.LuaFileName = 'parameters-{}.lua'.format(self.ip)
         with open(self.LuaFileName, "w") as LuaFile:
             LuaFile.write('require "helper"\n')
@@ -139,7 +139,7 @@ class RapidMachine(object):
             for index, dp_port in enumerate(self.dp_ports, start = 1):
                 LuaFile.write('local_ip{}="{}"\n'.format(index, dp_port['ip']))
                 LuaFile.write('local_hex_ip{}=convertIPToHex(local_ip{})\n'.format(index, index))
-            if vim in ['kubernetes']:
+            if self.vim in ['kubernetes']:
                 LuaFile.write("eal=\"--socket-mem=512,0 --file-prefix %s --pci-whitelist %s\"\n" % (self.name, self.machine_params['dp_pci_dev']))
             else:
                 LuaFile.write("eal=\"\"\n")
@@ -168,7 +168,7 @@ class RapidMachine(object):
                 self.read_cpuset()
                 self.remap_all_cpus()
             _, prox_config_file_name = os.path.split(self.machine_params['config_file'])
-            self.generate_lua(self.vim, self.machine_params['config_file'])
+            self.generate_lua()
             self._client.scp_put(self.machine_params['config_file'], '{}/{}'.format(self.rundir, prox_config_file_name))
             if ((not self.configonly) and self.machine_params['prox_launch_exit']):
                 cmd = 'sudo {}/prox {} -t -o cli -f {}/{}'.format(self.rundir, autostart, self.rundir, prox_config_file_name)
index a54caba..3c13d1a 100644 (file)
@@ -183,6 +183,7 @@ class RapidTest(object):
         r = 0;
         sleep_time = 2
         while (r < self.test['maxr']):
+            self.gen_machine.start_latency_cores()
             time.sleep(sleep_time)
             # Sleep_time is needed to be able to do accurate measurements to check for packet loss. We need to make this time large enough so that we do not take the first measurement while some packets from the previous tests migth still be in flight
             t1_rx, t1_non_dp_rx, t1_tx, t1_non_dp_tx, t1_drop, t1_tx_fail, t1_tsc, abs_tsc_hz = self.gen_machine.core_stats()
@@ -424,4 +425,5 @@ class RapidTest(object):
                 drop_rate = 100.0*tot_dp_drop/dp_tx
                 if ((drop_rate < self.test['drop_rate_threshold']) or (tot_dp_drop == self.test['drop_rate_threshold'] ==0) or (tot_dp_drop > self.test['maxz'])):
                     break
+            self.gen_machine.stop_latency_cores()
         return(pps_req_tx,pps_tx,pps_sut_tx,pps_rx,lat_avg,percentile,percentile_max,lat_max,dp_tx,dp_rx,tot_dp_drop,(t4_tx_fail - t1_tx_fail),drop_rate,lat_min,used_avg,r,tot_core_measurement_duration,avg_bg_rate,bucket_size,buckets)