From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D1408A04F0; Fri, 27 Dec 2019 09:30:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C18691BFF7; Fri, 27 Dec 2019 09:30:01 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CE7171BFEE for ; Fri, 27 Dec 2019 09:29:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2019 00:29:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,362,1571727600"; d="scan'208";a="220456429" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 27 Dec 2019 00:29:57 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Dec 2019 00:29:56 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Dec 2019 00:29:56 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.195]) with mapi id 14.03.0439.000; Fri, 27 Dec 2019 16:29:55 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V2] tests: add testsuite cbdma Thread-Index: AQHVu6wRYeUjyRDB1UKo1EJr2pfMMafNpLYg Date: Fri, 27 Dec 2019 08:29:53 +0000 Message-ID: References: <1577310748-11083-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1577310748-11083-1-git-send-email-lihongx.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2NjOTY4MzItMjViYS00Yjk4LWIxMTUtMjQ2MzNlOTlhZDRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRWgxU3JGcGI4dTliNGFaaHdDM3NDelR0UEQxdWRIVGFaeHN5ZU84dFptZEVZbU1iN3pJdllkMEJtakdzUHJ2NyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2] tests: add testsuite cbdma X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B12=1B$B7n=1B(B26=1B$BF|=1B(B 5:52 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts][PATCH V2] tests: add testsuite cbdma >=20 > Signed-off-by: lihong >=20 > v2: use self.tester.pktgen to config stream and send pkts >=20 > v1: add testsuite cbdma >=20 > --- > tests/TestSuite_cbdma.py | 369 > +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 369 insertions(+) > create mode 100644 tests/TestSuite_cbdma.py >=20 > diff --git a/tests/TestSuite_cbdma.py b/tests/TestSuite_cbdma.py new file= mode > 100644 index 0000000..fd9aec9 > --- /dev/null > +++ b/tests/TestSuite_cbdma.py > @@ -0,0 +1,369 @@ > +# BSD LICENSE > +# > +# Copyright(c) <2019> Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY # > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE # > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +""" > +DPDK Test suite. > +""" > + > +import utils > +import re > +import time > +from test_case import TestCase > +from packet import Packet > +from pktgen import TRANSMIT_CONT > + > + > +class TestCBDMA(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.frame_sizes =3D [64, 256, 512, 1024, 1518] > + self.cbdma_dev_infos =3D [] > + self.device_str =3D None > + self.dut_ports =3D self.dut.get_ports() > + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports for = testing") > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + self.get_cbdma_ports_info_and_bind_to_dpdk() > + out =3D self.dut.build_dpdk_apps('./examples/ioat/') > + self.verify('Error' not in out, 'compilation ioat error') > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + # Prepare the result table > + self.table_header =3D ['Frame'] > + self.table_header.append("Mpps") > + self.table_header.append("Thread Num") > + self.table_header.append("Queue Num") > + self.table_header.append("Copy Mode") > + self.table_header.append("Updating MAC") > + self.table_header.append("% linerate") > + self.result_table_create(self.table_header) > + > + def get_core_list(self): > + """ > + get cores list depend on thread_num > + """ > + core_config =3D '1S/%dC/1T' % self.cbdma_cores_num > + self.core_list =3D self.dut.get_core_list( > + core_config, socket=3Dself.ports_socket) > + self.verify(len(self.core_list) >=3D self.cbdma_cores_num, > + 'There no enough cores to run this > + case') > + > + def get_cbdma_ports_info_and_bind_to_dpdk(self): > + """ > + get all cbdma ports > + """ > + str_info =3D 'Misc (rawdev) devices using kernel driver' > + out =3D self.dut.send_expect('./usertools/dpdk-devbind.py --stat= us-dev > misc', > + '# ', 30) > + device_info =3D out.split('\n') > + for device in device_info: > + pci_info =3D re.search('\s*(0000:\d*:\d*.\d*)', device) > + if pci_info is not None: > + dev_info =3D pci_info.group(1) > + # the numa id of ioat dev, only add the device which > + # on same socket with nic dev > + bus =3D int(dev_info[5:7], base=3D16) > + if bus >=3D 128: > + cur_socket =3D 1 > + else: > + cur_socket =3D 0 > + if self.ports_socket =3D=3D cur_socket: > + self.cbdma_dev_infos.append(pci_info.group(1)) > + self.verify(len(self.cbdma_dev_infos) >=3D 8, 'There no enough c= bdma > device to run this suite') > + self.device_str =3D ' '.join(self.cbdma_dev_infos[0:8]) > + self.dut.send_expect('./usertools/dpdk-devbind.py --force > --bind=3Digb_uio %s' % > + self.device_str, '# ', 60) > + > + def bind_cbdma_device_to_kernel(self): > + if self.device_str is not None: > + self.dut.send_expect('modprobe ioatdma', '# ') > + self.dut.send_expect('./usertools/dpdk-devbind.py -u %s' % > self.device_str, '# ', 30) > + self.dut.send_expect('./usertools/dpdk-devbind.py --force > --bind=3Dioatdma %s' % self.device_str, > + '# ', 60) > + > + def get_ports_info(self): > + dev_info =3D [] > + for i in range(self.cbdma_nic_dev_num): > + dev_info.append(self.dut.ports_info[i]['pci']) > + for i in range(self.cbdma_ioat_dev_num): > + dev_info.append(self.cbdma_dev_infos[i]) > + return dev_info > + > + def launch_ioatfwd_app(self, eal_params): > + """ > + launch ioatfwd with different params > + """ > + port_info =3D 0 > + for i in range(self.cbdma_nic_dev_num): > + port_info |=3D 1 << i > + > + mac_info =3D '' > + if self.cbdma_updating_mac =3D=3D 'disable': > + mac_info =3D '--no-mac-updating' > + ''' > + when start cbdma app, default cores num is 2, it will only one t= hread > + when the cores num > 2, there will have 2 thread, and the max va= lue > of thread > + num is 2 > + ''' > + # flush other output > + self.dut.get_session_output(timeout=3D1) > + cmd_command =3D './examples/ioat/build/app/ioatfwd ' + eal_param= s > + \ > + '-- -p %s -q %d %s -c %s' % (hex(port_info), > + > self.cbdma_ioat_dev_num/self.cbdma_nic_dev_num, mac_info, > + self.cbdma_copy_mode) > + self.dut.send_expect(cmd_command, 'ioatfwd,') > + time.sleep(1) > + out =3D self.dut.get_session_output(timeout=3D1) > + thread_num =3D 2 if self.cbdma_cores_num > 2 else 1 > + o_thread_info =3D 'Worker Threads =3D %d' % thread_num > + o_copy_info =3D 'Copy Mode =3D %s' % self.cbdma_copy_mode > + o_update_mac =3D 'Updating MAC =3D %s' % self.cbdma_updating_mac > + o_queue_info =3D 'Rx Queues =3D %d' % > (self.cbdma_ioat_dev_num/self.cbdma_nic_dev_num) > + self.verify(o_thread_info in out and o_copy_info in out and > + o_update_mac in out and o_queue_info in out, > + 'The output info not match setting for the cmd, > + please check') > + > + def config_stream(self, frame_size): > + stream_ids =3D [] > + for port in range(self.cbdma_nic_dev_num): > + tx_port =3D self.tester.get_local_port(self.dut_ports[port]) > + rx_port =3D tx_port > + if self.cbdma_nic_dev_num > 1: > + if port % self.cbdma_nic_dev_num =3D=3D 0: > + rx_port =3D > self.tester.get_local_port(self.dut_ports[port+1]) > + else: > + rx_port =3D > self.tester.get_local_port(self.dut_ports[port-1]) > + dst_mac =3D self.dut.get_mac_address(self.dut_ports[port]) > + # pkt config > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dframe_size) > + pkt.config_layer('ether', {'dst': '%s' % dst_mac}) > + pkt.config_layer('udp', {'src': 1111, 'dst': 1112}) > + pkt.save_pcapfile(self.tester, "%s/cbdma_%d.pcap" % > + (self.tester.tmp_file, port)) > + > + stream_option =3D { > + 'pcap': "%s/cbdma_%d.pcap" % (self.tester.tmp_file, port= ), > + 'fields_config': { > + 'ip': {'src': {'action': 'random', 'start': '16.0.0.= 1', 'step': > 1, 'end': '16.0.0.64'}}}, > + 'stream_config': { > + 'rate': 100, > + 'transmit_mode': TRANSMIT_CONT, > + } > + } > + stream_id =3D self.tester.pktgen.add_stream(tx_port, tx_port= , > + "%s/cbdma_%d.pcap" % > (self.tester.tmp_file, port)) > + self.tester.pktgen.config_stream(stream_id, stream_option) > + stream_ids.append(stream_id) > + > + return stream_ids > + > + def send_and_verify_throughput(self, check_channel=3DFalse): > + """ > + Send packet with packet generator and verify > + """ > + for frame_size in self.frame_sizes: > + self.tester.pktgen.clear_streams() > + stream_ids =3D self.config_stream(frame_size) > + traffic_opt =3D { > + 'method': 'throughput', > + 'rate': 100, > + 'duration': 20} > + _, pps =3D self.tester.pktgen.measure(stream_ids, traffic_op= t) > + self.verify(pps > 0, "%s can not receive packets of frame > size %d" % (self.running_case, frame_size)) > + self.update_result_tables(frame_size, pps) > + if check_channel: > + self.check_enqueue_packets_of_each_channel() > + > + def check_enqueue_packets_of_each_channel(self): > + """ > + Check stats of ioat app, each ioat channel can enqueue packets > + """ > + out =3D self.dut.get_session_output(timeout=3D2) > + index =3D out.rfind('Statistics for port 0') > + out =3D out[index:] > + data_info =3D re.findall('successful_enqueues:\s*(\d*)', out) > + self.verify(len(data_info) =3D=3D self.cbdma_ioat_dev_num, 'Ther= e miss > some queue, the run queue is ' > + '%d, and expect queue num is %d' % (len(data_info), > self.cbdma_ioat_dev_num)) > + for index in range(self.cbdma_ioat_dev_num): > + self.verify(data_info[index] !=3D 0, 'the queue %d can not > + enqueues data' % index) > + > + def update_result_tables(self, frame_size, pps): > + Mpps =3D pps / 1000000.0 > + throughput =3D Mpps * 100 / \ > + float(self.wirespeed(self.nic, frame_size, > self.cbdma_nic_dev_num)) > + thread_num =3D 2 if self.cbdma_cores_num > 2 else 1 > + results_row =3D [frame_size] > + results_row.append(Mpps) > + results_row.append(thread_num) > + > results_row.append(self.cbdma_ioat_dev_num/self.cbdma_nic_dev_num) > + results_row.append(self.cbdma_copy_mode) > + results_row.append(self.cbdma_updating_mac) > + results_row.append(throughput) > + self.result_table_add(results_row) > + > + def test_perf_cbdma_basic_test(self): > + """ > + CMDBMA basic test with differnet size packets > + one cbdma port and one nic port with 1 queue 1 thread > + """ > + self.cbdma_cores_num =3D 2 > + self.cbdma_nic_dev_num =3D 1 > + self.cbdma_ioat_dev_num =3D 1 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + self.get_core_list() > + dev_info =3D self.get_ports_info() > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + self.result_table_print() > + > + def test_perf_cbdma_with_multi_thread(self): > + """ > + CBDMA test with multi-thread > + one cbdma port and on nic port with 1 queue 2 thread > + """ > + self.cbdma_cores_num =3D 3 > + self.cbdma_nic_dev_num =3D 1 > + self.cbdma_ioat_dev_num =3D 1 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + self.get_core_list() > + dev_info =3D self.get_ports_info() > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + self.result_table_print() > + > + def test_perf_cbdma_with_multi_nic_ports(self): > + """ > + CBDMA test with multi nic ports > + two cbdma port and two nic port with 1 queue 1 thread > + """ > + self.cbdma_cores_num =3D 5 > + self.cbdma_nic_dev_num =3D 2 > + self.cbdma_ioat_dev_num =3D 2 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + self.get_core_list() > + dev_info =3D self.get_ports_info() > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DTrue) > + self.result_table_print() > + > + def test_perf_cbdma_with_multi_queues(self): > + """ > + CBDMA test with multi queues > + one nic port and 2/4/8 cbdma port with 2 thread > + """ > + self.cbdma_cores_num =3D 3 > + self.cbdma_nic_dev_num =3D 1 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + queue_num_list =3D [2, 4, 8] > + self.get_core_list() > + > + for queue_num in queue_num_list: > + self.cbdma_ioat_dev_num =3D queue_num > + dev_info =3D self.get_ports_info() > + eal_params =3D > self.dut.create_eal_parameters(cores=3Dself.core_list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DTrue) > + self.dut.send_expect('^c', '# ') > + self.result_table_print() > + > + def test_perf_cbdma_with_diff_update_mac(self): > + """ > + CBDMA performance cmparison between mac-updating and > no-mac-updating > + 2 cbdma port and 1 nic port with 2 queue 1 thread > + """ > + self.cbdma_cores_num =3D 2 > + self.cbdma_nic_dev_num =3D 1 > + self.cbdma_ioat_dev_num =3D 2 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + self.get_core_list() > + dev_info =3D self.get_ports_info() > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + > + self.dut.send_expect('^c', '# ') > + self.cbdma_updating_mac =3D 'disable' > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + self.result_table_print() > + > + def test_perf_cbdma_with_diff_copy_mode(self): > + """ > + CBDMA performance cmparison between hardware copies and > software copies > + 4 cbdma port and 1 nic port with 4 queue 2 thread > + """ > + self.cbdma_cores_num =3D 3 > + self.cbdma_nic_dev_num =3D 1 > + self.cbdma_ioat_dev_num =3D 4 > + self.cbdma_updating_mac =3D 'enable' > + self.cbdma_copy_mode =3D 'hw' > + self.get_core_list() > + dev_info =3D self.get_ports_info() > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + ports=3Ddev_info, > prefix=3D'cbdma') > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + > + self.dut.send_expect('^c', '# ') > + self.cbdma_copy_mode =3D 'sw' > + self.launch_ioatfwd_app(eal_params) > + self.send_and_verify_throughput(check_channel=3DFalse) > + self.result_table_print() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect('^c', '# ') > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.bind_cbdma_device_to_kernel() > -- > 2.7.4