def test_perf_ipfrag_throughtput(self):
        """
        Performance test for 64, 1518, 1519, 2k and 9k.
        """
        self.tester.send_expect("ifconfig %s mtu 9600" % self.tester.get_interface(self.tester.get_local_port(P0)), "#")
        self.tester.send_expect("ifconfig %s mtu 9600" % self.tester.get_interface(self.tester.get_local_port(P1)), "#")

        sizes = [64, 1518, 1519, 2000, 9000]

        tblheader = ["Ports", "S/C/T", "SW threads"]
        for size in sizes:
            tblheader.append("%dB Mpps" % size)
            tblheader.append("%d" % size)

        dts.results_table_add_header(tblheader)

        lcores = [("1S/1C/1T", 2), ("1S/1C/2T", 2), ("1S/2C/1T", 2), ("2S/1C/1T", 2)]
        index = 1
        for (lcore, numThr) in lcores:
            self.benchmark(index, lcore, numThr, sizes)
            index += 1

        dts.results_table_print()

        self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P0)), "#")
        self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P1)), "#")
Пример #2
0
    def test_perf_ipfrag_throughtput(self):
        """
        Performance test for 64, 1518, 1519, 2k and 9k.
        """
        self.tester.send_expect("ifconfig %s mtu 9600" % self.tester.get_interface(self.tester.get_local_port(P0)), "#")
        self.tester.send_expect("ifconfig %s mtu 9600" % self.tester.get_interface(self.tester.get_local_port(P1)), "#")

        sizes = [64, 1518, 1519, 2000, 9000]

        tblheader = ["Ports", "S/C/T", "SW threads"]
        for size in sizes:
            tblheader.append("%dB Mpps" % size)
            tblheader.append("%d" % size)

        dts.results_table_add_header(tblheader)

        lcores = [("1S/1C/1T", 2), ("1S/1C/2T", 2), ("1S/2C/1T", 2), ("2S/1C/1T", 2)]
        index = 1
        for (lcore, numThr) in lcores:
            self.benchmark(index, lcore, numThr, sizes)
            index += 1

        dts.results_table_print()

        self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P0)), "#")
        self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P1)), "#")
    def test_perf_checksum_throughtput(self):
        """
        Test checksum offload performance.
        """
        self.dut_ports = self.dut.get_ports_performance()
        # Verify that enough ports are available
        self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")

        # sizes = [64, 128, 256, 512, 1024]
        sizes = [64, 128]
        pkts = {
            'IP/UDP':
            'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))',
            'IP/TCP':
            'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))',
            'IP/SCTP':
            'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))',
            'IPv6/UDP':
            'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 else 0)(%d))',
            'IPv6/TCP':
            'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 else 0)(%d))'
        }

        lcore = "1S/2C/1T"
        portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])

        for mode in ["sw", "hw"]:
            self.logger.info("%s performance" % mode)
            rst.write_text(mode + " Performance" + '\r\n')
            tblheader = ["Ports", "S/C/T", "Packet Type", "Mode"]
            for size in sizes:
                tblheader.append("%sB mpps" % str(size))
                tblheader.append("%sB %%   " % str(size))

            dts.results_table_add_header(tblheader)

            self.pmdout.start_testpmd(lcore,
                                      "--portmask=%s" % self.portMask,
                                      socket=self.ports_socket)

            self.dut.send_expect("set verbose 1", "testpmd> ")
            self.dut.send_expect("set fwd csum", "testpmd> ")

            if mode == "hw":
                self.checksum_enablehw(self.dut_ports[0])
                self.checksum_enablehw(self.dut_ports[1])
            else:
                self.checksum_enablesw(self.dut_ports[0])
                self.checksum_enablesw(self.dut_ports[1])

            self.dut.send_expect("start", "testpmd> ", 3)

            for ptype in pkts.keys():
                self.benchmark(lcore, ptype, mode, pkts[ptype], sizes,
                               self.nic)

            self.dut.send_expect("stop", "testpmd> ")
            self.dut.send_expect("quit", "#", 10)
            dts.results_table_print()
Пример #4
0
    def lcore_table_print(self, horizontal=False):
        if not horizontal:
            dts.results_table_add_header(['Socket', 'Core', 'Thread'])

            for lcore in self.cores:
                dts.results_table_add_row([lcore['socket'], lcore['core'], lcore['thread']])
            dts.results_table_print()
        else:
            dts.results_table_add_header(['X'] + [''] * len(self.cores))
            dts.results_table_add_row(['Thread'] + [n['thread'] for n in self.cores])
            dts.results_table_add_row(['Core'] + [n['core'] for n in self.cores])
            dts.results_table_add_row(['Socket'] + [n['socket'] for n in self.cores])
            dts.results_table_print()
Пример #5
0
    def test_perf_l3fwd_4ports(self):
        """
        L3fwd main 4 ports.
        """

        # Based on h/w type, choose how many ports to use
        ports = self.dut.get_ports()
        # Verify that enough ports are available
        self.verify(len(ports) >= 4, "Insufficient ports for speed testing")

        header_row = ["Frame size", "RX Queues/NIC Port", "S/C/T"]

        for method in TestL3fwd.methods:
            header_row.append('%s Mpps' % method)
            header_row.append('% linerate')

        dts.results_table_add_header(header_row)
        self.l3fwd_test_results['header'] = header_row
        self.l3fwd_test_results['data'] = []

        for frame_size in TestL3fwd.frame_sizes:

            # Prepare traffic flow
            payload_size = frame_size - HEADER_SIZE['udp'] - \
                HEADER_SIZE['ip'] - HEADER_SIZE['eth']

            for _port in range(4):
                dmac = self.dut.get_mac_address(valports[_port])
                flows = ['Ether(dst="%s")/%s/("X"*%d)' % (dmac, flow, payload_size) for flow in self.flows()[_port * 2:(_port + 1) * 2]]
                self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' % (valports[_port], string.join(flows, ',')))

            self.tester.scapy_execute()

            dts.report("Flows for 4 ports, %d frame size.\n" % (frame_size),
                       annex=True)
            dts.report("%s" % string.join(flows, '\n'),
                       frame=True, annex=True)

            # Get the number of sockets of the board
            number_sockets = self.dut.send_expect("grep \"processor\|physical id\|core id\|^$\" /proc/cpuinfo | grep physical | sort -u | wc -l", "# ")
            number_sockets = int(number_sockets.split('\r\n')[0])

            # Run case by case
            for test_case in TestL3fwd.test_cases_4_ports:

                # Check if the board has sockets enough for the test case
                if number_sockets >= int(test_case[1].split('/')[0][0]):
                    self.get_throughput(frame_size, *test_case)

        self.plot_4_ports()
        dts.results_table_print()
Пример #6
0
    def lcore_table_print(self, horizontal=False):
        if not horizontal:
            dts.results_table_add_header(['Socket', 'Core', 'Thread'])

            for lcore in self.cores:
                dts.results_table_add_row(
                    [lcore['socket'], lcore['core'], lcore['thread']])
            dts.results_table_print()
        else:
            dts.results_table_add_header(['X'] + [''] * len(self.cores))
            dts.results_table_add_row(['Thread'] +
                                      [n['thread'] for n in self.cores])
            dts.results_table_add_row(['Core'] +
                                      [n['core'] for n in self.cores])
            dts.results_table_add_row(['Socket'] +
                                      [n['socket'] for n in self.cores])
            dts.results_table_print()
Пример #7
0
    def set_up_all(self):
        """
        Run at the start of each test suite.

        L2fwd prerequisites.
        """
        self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1518]

        self.test_queues = [{'queues': 1, 'Mpps': {}, 'pct': {}},
                            {'queues': 2, 'Mpps': {}, 'pct': {}},
                            {'queues': 4, 'Mpps': {}, 'pct': {}},
                            {'queues': 8, 'Mpps': {}, 'pct': {}}
                            ]

        self.core_config = "1S/4C/1T"
        self.number_of_ports = 2
        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
            HEADER_SIZE['udp']

        self.dut_ports = self.dut.get_ports_performance()

        self.verify(len(self.dut_ports) >= self.number_of_ports,
                    "Not enough ports for " + self.nic)

        self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])

        # compile
        out = self.dut.build_dpdk_apps("./examples/l2fwd")
        self.verify("Error" not in out, "Compilation error")
        self.verify("No such" not in out, "Compilation error")

        self.table_header = ['Frame']
        for queue in self.test_queues:
            self.table_header.append("%d queues Mpps" % queue['queues'])
            self.table_header.append("% linerate")

        dts.results_table_add_header(self.table_header)
        self.plotting = Plotting(self.dut.crb['name'], self.target, self.nic)
Пример #8
0
    def test_perf_l3fwd_2ports(self):
        """
        L3fwd main 2 ports.
        """

        header_row = ["Frame", "Ports", "S/C/T", "Mpps", "% linerate", "mode"]
        self.l3fwd_test_results['header'] = header_row
        dts.results_table_add_header(header_row)
        self.l3fwd_test_results['data'] = []

        for frame_size in TestL3fwd.frame_sizes:

            # Prepare traffic flow
            payload_size = frame_size - HEADER_SIZE['udp'] - \
                HEADER_SIZE['ip'] - HEADER_SIZE['eth']

            flows = ['Ether()/%s/("X"*%d)' % (flow, payload_size) for flow in self.flows()[:4]]

            dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size),
                       annex=True)
            dts.report("%s" % string.join(flows, '\n'),
                       frame=True, annex=True)

            self.tester.scapy_append('wrpcap("test2ports.pcap", [%s])' % string.join(flows, ','))
            self.tester.scapy_execute()

            # Prepare the command line
            global corelist
            pat = re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")
            coreMask = {}
            rtCmdLines = dict(TestL3fwd.test_cases_2_ports)
            for key in rtCmdLines.keys():
                corelist = []
                while pat.search(rtCmdLines[key]):
                    rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
                self.logger.info("%s\n" % str(corelist))
                coreMask[key] = dts.create_mask(set(corelist))

            # measure by two different mode
            for mode in TestL3fwd.methods:

                # start l3fwd
                index = 0
                subtitle = []
                for cores in rtCmdLines.keys():

                    info = "Executing l3fwd using %s mode, 2 ports, %s and %d frame size.\n" % (
                           mode, cores, frame_size)

                    self.logger.info(info)
                    dts.report(info, annex=True)

                    subtitle.append(cores)
                    cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores],
                                                   self.dut.get_memory_channels(), dts.create_mask(valports[:2]))

                    dts.report(cmdline + "\n", frame=True, annex=True)

                    out = self.dut.send_expect(cmdline, "L3FWD:", 120)

                    # Measure test
                    tgenInput = []
                    for rxPort in range(2):
                        # No use on rx/tx limitation
                        if rxPort % 2 == 0:
                            txIntf = self.tester.get_local_port(valports[rxPort + 1])
                        else:
                            txIntf = self.tester.get_local_port(valports[rxPort - 1])

                        rxIntf = self.tester.get_local_port(valports[rxPort])

                        tgenInput.append((txIntf, rxIntf, "test2ports.pcap"))

                    _, pps = self.tester.traffic_generator_throughput(tgenInput)
                    self.verify(pps > 0, "No traffic detected")
                    pps /= 1000000.0
                    linerate = self.wirespeed(self.nic, frame_size, 2)
                    pct = pps * 100 / linerate

                    index += 1

                    # Stop l3fwd
                    self.dut.send_expect("^C", "#")

                    data_row = [frame_size, 2, cores, str(pps), str(pct), mode]
                    dts.results_table_add_row(data_row)
                    self.l3fwd_test_results['data'].append(data_row)

        self.plot_2_ports()
        dts.results_table_print()
Пример #9
0
    def test_perf_pmd_performance_2ports(self):
        """
        PMD Performance Benchmarking with 2 ports.
        """

        all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))

        # prepare traffic generator input
        tgen_input = []
        tgen_input.append(
            (self.tester.get_local_port(self.dut_ports[0]),
             self.tester.get_local_port(self.dut_ports[1]), "test.pcap"))
        tgen_input.append(
            (self.tester.get_local_port(self.dut_ports[1]),
             self.tester.get_local_port(self.dut_ports[0]), "test.pcap"))

        # run testpmd for each core config
        for test_cycle in self.test_cycles:
            core_config = test_cycle['cores']

            core_list = self.dut.get_core_list(core_config,
                                               socket=self.ports_socket)

            if len(core_list) > 2:
                queues = len(core_list) / 2
            else:
                queues = 1

            core_mask = dts.create_mask(core_list)
            port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])

            self.pmdout.start_testpmd(
                "all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" %
                (core_mask, queues, queues, port_mask))
            command_line = self.pmdout.get_pmd_cmd()

            info = "Executing PMD using %s\n" % test_cycle['cores']
            self.logger.info(info)
            dts.report(info, annex=True)
            dts.report(command_line + "\n\n", frame=True, annex=True)

            self.dut.send_expect("start", "testpmd> ")
            for frame_size in self.frame_sizes:
                wirespeed = self.wirespeed(self.nic, frame_size, 2)

                # create pcap file
                self.logger.info("Running with frame size %d " % frame_size)
                payload_size = frame_size - self.headers_size
                self.tester.scapy_append(
                    'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP()/UDP()/("X"*%d)])'
                    % payload_size)
                self.tester.scapy_execute()

                # run traffic generator
                _, pps = self.tester.traffic_generator_throughput(tgen_input)

                pps /= 1000000.0
                test_cycle['Mpps'][frame_size] = pps
                test_cycle['pct'][frame_size] = pps * 100 / wirespeed

            self.dut.send_expect("stop", "testpmd> ")
            self.dut.send_expect("quit", "# ", 30)
            sleep(5)

        for n in range(len(self.test_cycles)):
            for frame_size in self.frame_sizes:
                self.verify(self.test_cycles[n]['Mpps'][frame_size] > 0,
                            "No traffic detected")

        # Print results
        dts.results_table_add_header(self.table_header)
        for frame_size in self.frame_sizes:
            table_row = [frame_size]
            for test_cycle in self.test_cycles:
                table_row.append(test_cycle['Mpps'][frame_size])
                table_row.append(test_cycle['pct'][frame_size])

            dts.results_table_add_row(table_row)

        self.plot_results(number_ports=2)
        dts.results_table_print()
Пример #10
0
    def test_perf_multiprocess_client_serverperformance(self):
        """
        Benchmark Multiprocess client-server performance.
        """
        self.dut.kill_all()
        self.dut.send_expect("fg", "# ")
        dutPorts = self.dut.get_ports()
        txPort = self.tester.get_local_port(dutPorts[0])
        rxPort = self.tester.get_local_port(dutPorts[1])
        mac = self.tester.get_mac(txPort)

        self.tester.scapy_append('dmac="%s"' %
                                 self.dut.get_mac_address(dutPorts[0]))
        self.tester.scapy_append('smac="%s"' % mac)
        if not self.dut.want_perf_tests:
            self.tester.scapy_append(
                'flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.%s" % src, dst="192.168.1.%s" % dst)/("X"*26) for src in range(64) for dst in range(64)]'
            )
        else:
            self.tester.scapy_append(
                'flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.1", dst="192.168.1.1")/("X"*26)]'
            )
        self.tester.scapy_append('wrpcap("test.pcap", flows)')
        self.tester.scapy_execute()

        validExecutions = []
        for execution in executions:
            if len(self.dut.get_core_list(
                    execution['cores'])) == execution['nprocs']:
                validExecutions.append(execution)

        for execution in validExecutions:
            coreList = self.dut.get_core_list(execution['cores'])

            coreMask = dts.create_mask(self.dut.get_core_list('1S/1C/1T'))
            portMask = dts.create_mask([dutPorts[0], dutPorts[1]])
            self.dut.send_expect(
                "./examples/multi_process/client_server_mp/mp_server/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d"
                % (self.target, self.dut.get_memory_channels(), "0xA0",
                   portMask, execution['nprocs']), "Finished Process Init", 20)
            self.dut.send_expect("^Z", "\r\n")
            self.dut.send_expect("bg", "# ")

            for n in range(execution['nprocs']):
                time.sleep(5)
                coreMask = dts.create_mask([coreList[n]])
                self.dut.send_expect(
                    "./examples/multi_process/client_server_mp/mp_client/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d"
                    %
                    (self.target, self.dut.get_memory_channels(), coreMask, n),
                    "Finished Process Init")
                self.dut.send_expect("^Z", "\r\n")
                self.dut.send_expect("bg", "# ")

            tgenInput = []
            tgenInput.append([txPort, rxPort, "test.pcap"])
            _, pps = self.tester.traffic_generator_throughput(tgenInput)
            execution['pps'] = pps
            self.dut.kill_all()
            time.sleep(5)

        for n in range(len(executions)):
            self.verify(executions[n]['pps'] is not 0, "No traffic detected")

        dts.results_table_add_header([
            'Server threads', 'Server Cores/Threads', 'Num-procs',
            'Sockets/Cores/Threads', 'Num Ports', 'Frame Size',
            '%-age Line Rate', 'Packet Rate(mpps)'
        ])

        for execution in validExecutions:
            dts.results_table_add_row([
                1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64,
                execution['pps'] / float(100000000 / (8 * 84)),
                execution['pps'] / float(1000000)
            ])

        dts.results_table_print()
Пример #11
0
    def test_perf_pmd_performance_2ports(self):
        """
        PMD Performance Benchmarking with 2 ports.
        """

        all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))

        # prepare traffic generator input
        tgen_input = []
        tgen_input.append((self.tester.get_local_port(self.dut_ports[0]),
                           self.tester.get_local_port(self.dut_ports[1]),
                           "test.pcap"))
        tgen_input.append((self.tester.get_local_port(self.dut_ports[1]),
                           self.tester.get_local_port(self.dut_ports[0]),
                           "test.pcap"))

        # run testpmd for each core config
        for test_cycle in self.test_cycles:
            core_config = test_cycle['cores']

            core_list = self.dut.get_core_list(core_config,
                                               socket=self.ports_socket)

            if len(core_list) > 2:
                queues = len(core_list) / 2
            else:
                queues = 1

            core_mask = dts.create_mask(core_list)
            port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])

            self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask))
            command_line = self.pmdout.get_pmd_cmd()

            info = "Executing PMD using %s\n" % test_cycle['cores']
            self.logger.info(info)
            dts.report(info, annex=True)
            dts.report(command_line + "\n\n", frame=True, annex=True)

            self.dut.send_expect("start", "testpmd> ")
            for frame_size in self.frame_sizes:
                wirespeed = self.wirespeed(self.nic, frame_size, 2)

                # create pcap file
                self.logger.info("Running with frame size %d " % frame_size)
                payload_size = frame_size - self.headers_size
                self.tester.scapy_append(
                    'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP()/UDP()/("X"*%d)])' % payload_size)
                self.tester.scapy_execute()

                # run traffic generator
                _, pps = self.tester.traffic_generator_throughput(tgen_input)

                pps /= 1000000.0
                test_cycle['Mpps'][frame_size] = pps
                test_cycle['pct'][frame_size] = pps * 100 / wirespeed

            self.dut.send_expect("stop", "testpmd> ")
            self.dut.send_expect("quit", "# ", 30)
            sleep(5)

        for n in range(len(self.test_cycles)):
            for frame_size in self.frame_sizes:
                self.verify(self.test_cycles[n]['Mpps'][
                            frame_size] > 0, "No traffic detected")

        # Print results
        dts.results_table_add_header(self.table_header)
        for frame_size in self.frame_sizes:
            table_row = [frame_size]
            for test_cycle in self.test_cycles:
                table_row.append(test_cycle['Mpps'][frame_size])
                table_row.append(test_cycle['pct'][frame_size])

            dts.results_table_add_row(table_row)

        self.plot_results(number_ports=2)
        dts.results_table_print()