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 9E4B9A04DD; Thu, 2 Jan 2020 03:19:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 933241BF82; Thu, 2 Jan 2020 03:19:05 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2D5B81BF7E for ; Thu, 2 Jan 2020 03:19:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2020 18:19:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,385,1571727600"; d="scan'208";a="214025727" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga008.jf.intel.com with ESMTP; 01 Jan 2020 18:19:03 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Jan 2020 18:19:02 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Jan 2020 18:19:02 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.30]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.139]) with mapi id 14.03.0439.000; Thu, 2 Jan 2020 10:19:01 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V2] tests: add testsuite cbdma Thread-Index: AQHVu6wa4d4y1gUYuEqTw7zDhT/+OKfWrpkQ Date: Thu, 2 Jan 2020 02:19:00 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBA0DA7@SHSMSX101.ccr.corp.intel.com> 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: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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="us-ascii" 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" applied > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Thursday, December 26, 2019 5:52 AM > 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, ma= c_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_port= s[port+1]) > + else: > + rx_port =3D self.tester.get_local_port(self.dut_port= s[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 si= ze %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'cbdm= a') > + 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'cbd= ma') > + 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'cbdm= a') > + 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.c= ore_list, > + ports=3Ddev_info, prefix=3D'cbdm= a') > + 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'cbdm= a') > + 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'cbdm= a') > + 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