From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C68A4291B; Tue, 11 Apr 2023 10:16:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87C72410F9; Tue, 11 Apr 2023 10:16:53 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 6F9CA40A8B for ; Tue, 11 Apr 2023 10:16:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681201011; x=1712737011; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=A4g81yvHDMFrAzkOuC7HwwYS2DaZOLm+q0FkjaPUwNo=; b=TWTY6Sz4ZH+Hzs1vIsFQ+hhWsvLdbS6efqlDWUwuO7stWlxYeNDrAjrk VuCwqm9FUdxpOF/iN7enYPoPJxVKNIa/o/GyVFY6C3n+W+vVrGVcDvI9t R3TquSIhLydSgp0/en5ORGCZ7TkuNKblAo1WqwvaNwqhdzTvGuUKUGesq fnHq6mDTaBM6XLzG7YJ7pHkYFtM2wEo5aTa7+l4LCJePS/vh4dPkBaYfc YLvRoXvCkiu8XqSlrcSYtFjWheJ5nc7tcrpcMteLXCa23Ae/6Ih/tb9Rh pyyCPnQHE+gof2Xajn3XFKhTmSZRmDgPl3FsQUI9kaZiK+mhCLn/RXFDV w==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="327654818" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="327654818" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2023 01:16:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="777830078" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="777830078" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by FMSMGA003.fm.intel.com with ESMTP; 11 Apr 2023 01:16:50 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 11 Apr 2023 01:16:49 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 11 Apr 2023 01:16:49 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Tue, 11 Apr 2023 01:16:49 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Tue, 11 Apr 2023 01:16:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Po3Kc+6N6/VAyL6scz3oJD/gU5r/FsBCF04S3aTi6D0Naq7I/TaigfVlIKGqqQ0+WpRAjJ+adyXrGz2yh64Wi55VRHBS9Mu2u+gUdO4KVFScGELFluNVjMYMgruRvU8yb/txiad+UPP8MX+MJ0jTGwVaQh+e4R66ft68UGTisgNleSbwmKHZKrkQqO8vFhUQ+8FDCRpFGcQGCCEQbO4Fe1X5461Ncc6dUm/8nem7MEnRfN8bQB+4IX/yod3bizxsfrrOfzSg05pvvgjE2KX8jUjTutPr2+zG7R03YaJizx0OEFkwc3W9DOeiAlATLEl7fQ29Tdci7aUq8LxseDQUyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=myPssS0vTFK4GMiGvrMUsVWp7lQ4uDwxgpNS0+EgqEg=; b=VLq4HFTe+Hu/vYApXum3JocG2IuXZES3YEFHuX/KFk8ET9qTvdI7obRVRpHgm4h5+zrsO1lQY/aXMiZafRWOb7gaapQUJl5lyq+4xUhj5JJruZgsu+zXxFvynzafpeGrHX8OAI+m3Kw22B1m/4LBupneO2+vncCsXzODKcZpS/gVB3HQcA69JQdirLGrpC0Icv0IIf+k77n27xB4pmuMQfnnW0qqSymPcKNq5iIb7gMAFqerzdQCkcbZ/49cJOyLKufvNhBjdutcW/5d3EfhRz/i3ZJwGOzig2q4fEtBK8oEBtV8Elz0GLrDQU5CFtI8rzVLB4CyBUJXmsf54epSyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CY5PR11MB6187.namprd11.prod.outlook.com (2603:10b6:930:25::11) by PH0PR11MB5902.namprd11.prod.outlook.com (2603:10b6:510:14d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.34; Tue, 11 Apr 2023 08:16:42 +0000 Received: from CY5PR11MB6187.namprd11.prod.outlook.com ([fe80::1dc4:4584:f236:1177]) by CY5PR11MB6187.namprd11.prod.outlook.com ([fe80::1dc4:4584:f236:1177%2]) with mapi id 15.20.6254.030; Tue, 11 Apr 2023 08:16:41 +0000 From: "Tu, Lijuan" To: "Han, YingyaX" , "dts@dpdk.org" CC: "Han, YingyaX" Subject: RE: [dts][PATCH V2 2/3]tests: add i40e_multi_driver_perf test script Thread-Topic: [dts][PATCH V2 2/3]tests: add i40e_multi_driver_perf test script Thread-Index: AQHZZqPIdtHaEZcNdUanF1JvcNpea68lyo/Q Date: Tue, 11 Apr 2023 08:16:41 +0000 Message-ID: References: <20230404031525.896141-1-yingyax.han@intel.com> <20230404031525.896141-3-yingyax.han@intel.com> In-Reply-To: <20230404031525.896141-3-yingyax.han@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY5PR11MB6187:EE_|PH0PR11MB5902:EE_ x-ms-office365-filtering-correlation-id: 42fb0230-cc3c-49ad-060d-08db3a6514c2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VfXA2CxsOJ7xXqoJVzyKK45FtnzEoUOxaqonR2cot/4oRI/aodfTZDN0xiVtuNLvkHKOsSPelKHr6ETm2gisFF0EQdHtMiDqK/mR01zloHQVbq17ZqjiK7uu+VPzBUsvG7PCMGNIIUKReWs+lxNlXw03t9/yzS3vORbOz/Q43ycwU2kgnBRBWneysnWe9a+V4Or6f2L7Nl113fnftD0w3ZM2nYZYrC8igoTCa3PoSuslOLPVc0H2CsBHXKZ9mnQD4r/I025RiF4OpNlkbib1MhN6+xVS3vHKiL7uDQnqueyDv6D7ImQ7KvzAp1HOYX32mg5XkhIB8zHK2b9fFAQr1QpmypdKBkEDoK/15KNlu+BZtxbRqrea8nGcZKZYGPk/Hz96kZ0zTlVWjWy1M2YAUzUswM8C/1oR9i1fepZoQZCxiygGO+f8YuNqtdPTysrDjG0cJBk5j/9amsFDiRIXWo0Crx78hGjbhfJrXNF5Hsk889fQei/Q4KSLW7+M5rXA5wvZDEw7k9Zc9xDPeLoKuSEe64v/MLJ/gnnAR61bAmGNdq2bYUZPXJwBTRb04IFuO1oclyCIhnmDTlfaQ18BVUUMlgj9y7hTkUWg7KxoImudPans0VxPQRHReLgbeAhs x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY5PR11MB6187.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(136003)(396003)(39860400002)(376002)(451199021)(55016003)(82960400001)(83380400001)(76116006)(478600001)(186003)(7696005)(71200400001)(26005)(9686003)(19627235002)(110136005)(316002)(107886003)(6506007)(53546011)(2906002)(30864003)(52536014)(38100700002)(5660300002)(122000001)(66556008)(66446008)(64756008)(4326008)(41300700001)(66476007)(38070700005)(66946007)(8936002)(86362001)(8676002)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?haLNAQEif5a9YGhFdjKcslFqEj50GPd6svSHnd6QrJfI/Bv6p8rr5d3H/tIu?= =?us-ascii?Q?swlygJo6zWvyhg4x6L8U6BTUhKKcDPyybQOycvH/iHXJWsvylQos5TFmv0ON?= =?us-ascii?Q?bebaIiyEWb/DssupxjsWAO66als9AbkBv7qfCCA3BB9dTmg+RPiTQYEwCodD?= =?us-ascii?Q?Y2tSep3Ebco/65jfjLXjoy4k9NMG179PI5Sc4vWS9b56l0Cvb/9QLuopAZF1?= =?us-ascii?Q?fS9y6WQ1p+l28mP5t/LNPgkcW3z6Mm+hLGZQ18zgiBfCTh7EbLphN6dIphij?= =?us-ascii?Q?iF9wdfIk0mPHiREDS5YhXeMGf63LeOMurzciJjTc/pw9IG2VJo2ybjE7xZ6N?= =?us-ascii?Q?+OkrMkljEZkxT4eD+4ICfltLHvAn6YjV2HqWo2j7eRvtwIq9B13FaYQHiMcO?= =?us-ascii?Q?JQiOCArmXb0HHqvKiFV5TccHYlq02NXVP9zwLBa/Pt+VMd++xuzIImAeWWlj?= =?us-ascii?Q?p5RR3iPzjJGzTxyMaZhdZe3IsrFH4jTZ7iq4x3ygaSdAO17uZ3XoivkvmG5V?= =?us-ascii?Q?gguaDcRRbrRpIkRHCT3VYmhfIJwc5FXNCDDMmbTEOZFEwCO0aOpcOOjcv5oI?= =?us-ascii?Q?p3vRvLkCdlBA4r/J0eNEaas+x8jv73oOXwsxN1+aqepvmYTNS+PnJJ1lUAjl?= =?us-ascii?Q?FAEOvvChQnHIC6xhTIHdlaTeV3nbtcrwxPhiEhEsnG6DS5cFh3wkyVbRMCla?= =?us-ascii?Q?N5lS0U5Cff+GWC4/HjMYV+g98Sy3P0PqZVioP1TTDe0mn81oxl98nybAm38P?= =?us-ascii?Q?G+oleiYgLY6q21B/ZCu9k2V8YU6+n4qODMLKxn2hn0tswzsxApEt/VzTBtgF?= =?us-ascii?Q?qmtzQnzzumI1lTF8AhEVUyZ3YTF94HPL56dcq4Ub95g5/DJcvCYFNLjTwDAi?= =?us-ascii?Q?BI2+xG+DqxIEi5XEz/9z6xD6zEfAJo/wlcvuQjx6p9Dy/bBrRBs72o1JPDET?= =?us-ascii?Q?n5X4y9wU6d7F7i8eDgRHyMKpMJOvrw+dMpAjgxYBL59sm5GJ0VA/FEbEeo2E?= =?us-ascii?Q?1/Qsj6RrBKQ3C9hUNWmQyHwWMdcfUy4yYmWW/51+HpW072I0I1gZjpm4a4/3?= =?us-ascii?Q?Bpfz9IvzDRRt3xyy6GMdUGil92kkRn7MsAXeyCLmExsIaZ0+tYJSOTsLV0s5?= =?us-ascii?Q?G5+TjIeAfeUWklUrchYIBiuiDWTws6ClQ8mMxsh+T2zEH/kIuceu6GGNYbVL?= =?us-ascii?Q?ebcp/DG+R4WhoW04fcnfeiaEmszxrOkKrfkwKZE3kjTCRBzwsEUl5lWUA/TU?= =?us-ascii?Q?WGTdcdgT1+Wa4CWLh8V9EGrUAmkB4lX9IzuXdaqFi4dkJqKdF/icNBHyYvGp?= =?us-ascii?Q?MFJvhqycRnpwX6gPB8E6WFbCfe3EXn7L5IuWR8IT/U8YRUkZSbxNP7QAXyIS?= =?us-ascii?Q?rJ67LTj/8QPsP0U2pQEUiVpUdFLWe84aoWidFWZhXlUvjajarrFpshU/79p1?= =?us-ascii?Q?49OnUS1/r/euU5KzsdOMe1ncCYL4qLfxa1LfA8IoX58P+NW11SNFgm3xkNc2?= =?us-ascii?Q?Yqg2kxR1twZILWsuqcpEyKiKmaBqrvZpJYUQC8QfVL0wQielWKkQpNf+bmJg?= =?us-ascii?Q?TL88kkUOewhcyEa55hYi7NRaZ3SAKPTrVmFujPb0?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY5PR11MB6187.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42fb0230-cc3c-49ad-060d-08db3a6514c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2023 08:16:41.7214 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: slmqYqi0NIKCyqJtsSd01RLzAwnAQArbgu/2Dk768Ep8SfHmjpq8q2VQDpWIbr8Xm2ffXPTmJMsWKY4rRqoVQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5902 X-OriginatorOrg: intel.com X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 > -----Original Message----- > From: Yingya Han > Sent: Tuesday, April 4, 2023 11:15 AM > To: dts@dpdk.org > Cc: Han, YingyaX > Subject: [dts][PATCH V2 2/3]tests: add i40e_multi_driver_perf test script >=20 > Signed-off-by: Yingya Han > --- > tests/TestSuite_i40e_multi_driver_perf.py | 341 ++++++++++++++++++++++ > 1 file changed, 341 insertions(+) > create mode 100644 tests/TestSuite_i40e_multi_driver_perf.py >=20 > diff --git a/tests/TestSuite_i40e_multi_driver_perf.py > b/tests/TestSuite_i40e_multi_driver_perf.py > new file mode 100644 > index 00000000..a1be9053 > --- /dev/null > +++ b/tests/TestSuite_i40e_multi_driver_perf.py > @@ -0,0 +1,341 @@ > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2023 Intel > +Corporation # > + > +""" > +DPDK Test suite. > +""" > + > +import os > +import re > +import time > +from copy import deepcopy > + > +from framework.exception import VerifyFailure from framework.packet > +import Packet from framework.pktgen import TRANSMIT_CONT from > +framework.pmd_output import PmdOutput from framework.settings import > +HEADER_SIZE from framework.test_case import TestCase from > +framework.utils import convert_int2ip, convert_ip2int > + > + > +class TestI40eMultiDriverPerf(TestCase): > + # > + # Test cases. > + # > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.verify( > + self.nic in ["I40E_25G-25G_SFP28", "I40E_40G-QSFP_A"], > + "NIC Unsupported: " + str(self.nic), > + ) I think the suite also support other 710 series cards. And checklist or supportlist should be added. > + self.rx_desc_size =3D self.get_suite_cfg().get("compile_rx_desc"= , 32) > + err_msg =3D ( > + "Rx desc only has 16B and 32B size, %d is not valid" % self.= rx_desc_size > + ) > + self.verify(self.rx_desc_size =3D=3D 16 or self.rx_desc_size =3D= =3D 32, err_msg) > + if self.rx_desc_size =3D=3D 16: > + extra_options =3D "-Dc_args=3D-DRTE_LIBRTE_I40E_16BYTE_RX_DE= SC" > + self.dut.build_install_dpdk(self.target, extra_options=3Dext= ra_options) I don't see the requirement in test plan, "set RX descriptor to 16", Is it = needed ? > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "At least 1 port is requ= ired to test") > + # get socket and cores > + self.socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + cores =3D self.dut.get_core_list("1S/8C/1T", socket=3Dself.socke= t) > + self.verify(cores, "Requested 8 cores failed") > + self.pmdout =3D PmdOutput(self.dut) > + self.core_offset =3D 3 > + self.test_content =3D > +self.get_test_content_from_cfg(self.get_suite_cfg()) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.test_result =3D {"header": [], "data": []} > + > + def flows(self): > + """ > + Return a list of packets that implements the flows described. > + """ > + return [ > + "198.18.0.0/24", > + "198.18.1.0/24", > + "198.18.2.0/24", > + "198.18.3.0/24", > + "198.18.4.0/24", > + "198.18.5.0/24", > + "198.18.6.0/24", > + "198.18.7.0/24", > + ] > + > + def parse_test_config(self, config): > + """ > + [n]C/[mT]-[i]Q > + n: how many physical core use for polling. > + m: how many cpu thread use for polling, if Hyper-threading d= isabled > + in BIOS, m equals n, if enabled, m is 2 times as n. > + i: how many queues use per port, so total queues =3D i x nb_= port > + """ > + pat =3D "(.*)/(.*)-(.*)" > + result =3D re.findall(pat, config) > + if not result: > + msg =3D f"{config} is wrong format, please check" > + raise VerifyFailure(msg) > + cores, threads, queue =3D result[0] > + _thread_num =3D int(int(threads[:-1]) // int(cores[:-1])) > + > + _thread =3D str(_thread_num) + "T" > + _cores =3D str(self.core_offset + int(cores[:-1])) + "C" > + cores_config =3D "/".join(["1S", _cores, _thread]) > + queues_per_port =3D int(queue[:-1]) > + return cores_config, _thread_num, queues_per_port > + > + def get_test_configs(self, test_parameters): > + configs =3D [] > + frame_sizes_grp =3D [] > + nb_desc =3D self.get_suite_cfg().get("rxtx_queue_size") > + for test_item, frame_sizes in sorted(test_parameters.items()): > + _frame_sizes =3D [int(frame_size) for frame_size in frame_si= zes] > + frame_sizes_grp.extend([int(item) for item in _frame_sizes]) > + cores, thread_num, queues =3D self.parse_test_config(test_it= em) > + corelist =3D self.dut.get_core_list(cores, self.socket) > + core_list =3D corelist[(self.core_offset - 1) * thread_num := ] > + if "2T" in cores: > + core_list =3D core_list[1:2] + core_list[0::2] + core_li= st[1::2][1:] > + _core_list =3D core_list[thread_num - 1 :] > + configs.append( > + [ > + test_item, > + _core_list, > + [ > + " --txd=3D{0} --rxd=3D{0}".format(nb_desc) > + + " --rxq=3D{0} --txq=3D{0}".format(queues) > + + " --nb-cores=3D{}".format(len(core_list) - thr= ead_num) > + ], > + ] > + ) > + return configs, sorted(set(frame_sizes_grp)) > + > + def get_test_content_from_cfg(self, test_content): > + test_content["flows"] =3D self.flows() > + configs, frame_sizes =3D > self.get_test_configs(test_content["test_parameters"]) > + test_content["configs"] =3D configs > + test_content["frame_sizes"] =3D frame_sizes > + return test_content > + > + def get_mac_layer(self, port_id): > + smac =3D "02:00:00:00:00:0%d" % port_id > + dmac =3D "52:00:00:00:00:0%d" % port_id > + layer =3D { > + "ether": { > + "dst": dmac, > + "src": smac, > + }, > + } > + return layer > + > + def get_ipv4_config(self, config): > + netaddr, mask =3D config.split("/") > + ip_range =3D int("1" * (32 - int(mask)), 2) > + start_ip =3D convert_int2ip(convert_ip2int(netaddr) + 1) > + end_ip =3D convert_int2ip(convert_ip2int(start_ip) + ip_range - = 1) > + layers =3D { > + "ipv4": { > + "src": start_ip, > + }, > + } > + fields_config =3D { > + "ip": { > + "src": { > + "start": start_ip, > + "end": end_ip, > + "step": 1, > + "action": "random", > + }, > + }, > + } > + return layers, fields_config > + > + def preset_flows_configs(self): > + flows =3D self.test_content.get("flows") > + flows_configs =3D [] > + for index, config in enumerate(flows): > + if index >=3D len(self.dut_ports): > + break > + port_id =3D self.dut_ports[index] > + _layer =3D self.get_mac_layer(port_id) > + _layer2, fields_config =3D self.get_ipv4_config(config) > + _layer.update(_layer2) > + flows_configs.append([_layer, fields_config]) > + return flows_configs > + > + def preset_streams(self): > + frame_sizes =3D self.test_content.get("frame_sizes") > + test_streams =3D {} > + flows_configs =3D self.preset_flows_configs() > + for frame_size in frame_sizes: > + for flow_config in flows_configs: > + _layers, fields_config =3D flow_config > + pkt =3D self.config_stream(_layers, frame_size) > + test_streams.setdefault(frame_size, []).append([pkt, fie= lds_config]) > + return test_streams > + > + def config_stream(self, layers, frame_size): > + """ > + Prepare traffic flow > + """ > + headers_size =3D sum([HEADER_SIZE[x] for x in ["eth", "ip"]]) > + payload_size =3D frame_size - headers_size > + # set streams for traffic > + pkt_config =3D { > + "type": "IP_RAW", > + "pkt_layers": {"raw": {"payload": ["58"] * payload_size}}, > + } > + pkt_config["pkt_layers"].update(layers) > + pkt_type =3D pkt_config.get("type") > + pkt_layers =3D pkt_config.get("pkt_layers") > + pkt =3D Packet(pkt_type=3Dpkt_type) > + for layer in list(pkt_layers.keys()): > + pkt.config_layer(layer, pkt_layers[layer]) > + > + return pkt.pktgen.pkt > + > + def add_stream_to_pktgen(self, streams, option): > + def port(index): > + p =3D self.tester.get_local_port(self.dut_ports[index]) > + return p > + > + topos =3D ( > + [ > + [port(index), port(index - 1)] > + if index % 2 > + else [port(index), port(index + 1)] > + for index, _ in enumerate(self.dut_ports) > + ] > + if len(self.dut_ports) > 1 > + else [[port(0), port(0)]] > + ) > + stream_ids =3D [] > + step =3D int(len(streams) / len(self.dut_ports)) > + for cnt, stream in enumerate(streams): > + pkt, fields_config =3D stream > + index =3D cnt // step > + txport, rxport =3D topos[index] > + _option =3D deepcopy(option) > + _option["pcap"] =3D pkt > + if fields_config: > + _option["fields_config"] =3D fields_config > + stream_id =3D self.tester.pktgen.add_stream(txport, rxport, = pkt) > + self.tester.pktgen.config_stream(stream_id, _option) > + stream_ids.append(stream_id) > + return stream_ids > + > + def start_testpmd(self, core_list, pci_para, eal): > + self.pmdout.start_testpmd(core_list, eal, pci_para, socket=3Dsel= f.socket) > + self.pmdout.wait_link_status_up("all", timeout=3D60) > + self.dut.send_expect("start", "testpmd> ", 15) > + > + def throughput(self, frame_size): > + streams =3D self.stream.get(frame_size) > + # set traffic option > + duration =3D self.test_content.get("test_duration") > + traffic_stop_wait_time =3D self.test_content.get("traffic_stop_w= ait_time", 0) > + # clear streams before add new streams > + self.tester.pktgen.clear_streams() > + # ser stream into pktgen > + stream_option =3D { > + "stream_config": { > + "txmode": {}, > + "transmit_mode": TRANSMIT_CONT, > + "rate": 100, > + } > + } > + traffic_option =3D { > + "method": "throughput", > + "duration": duration, > + } > + stream_ids =3D self.add_stream_to_pktgen(streams, stream_option) > + # run packet generator > + result =3D self.tester.pktgen.measure(stream_ids, traffic_option= ) > + time.sleep(traffic_stop_wait_time) > + # statistics result > + _, pps =3D result > + self.verify(pps > 0, "No traffic detected") > + self.logger.info( > + "Throughput of " > + + "framesize: {}, is: {} Mpps".format(frame_size, pps / 1000= 000) > + ) > + return result > + > + def display_result(self, datas): > + # display result table > + header_row =3D ["Fwd Core", "Frame Size", "Throughput", "Rate"] > + self.test_result["header"] =3D header_row > + self.result_table_create(header_row) > + self.test_result["data"] =3D [] > + for data in datas: > + config, frame_size, result =3D data > + _, pps =3D result > + pps /=3D 1000000.0 > + linerate =3D self.wirespeed(self.nic, frame_size, len(self.d= ut_ports)) > + percentage =3D pps * 100 / linerate > + data_row =3D [ > + config, > + frame_size, > + "{:.3f} Mpps".format(pps), > + "{:.3f}%".format(percentage), > + ] > + self.result_table_add(data_row) > + self.test_result["data"].append(data_row) > + self.result_table_print() > + > + def perf_test(self): > + """ > + Benchmarking test > + """ > + self.stream =3D self.preset_streams() > + # ports allow list > + pci_para =3D "" > + for port_id in self.dut_ports: > + pci_para +=3D ( > + "-a " > + + self.dut.ports_info[port_id]["port"].pci > + + ",support-multi-driver=3D1 " > + ) > + results =3D [] > + for config, core_list, eal in self.test_content["configs"]: > + self.logger.info( > + ("Executing Test Using cores: {0} of config {1}, ").form= at( > + core_list, config > + ) > + ) > + self.start_testpmd(core_list, pci_para, eal[0]) > + for frame_size in self.test_content["frame_sizes"]: > + self.logger.info("Test running at framesize: {}".format(= frame_size)) > + result =3D self.throughput(frame_size) > + if result: > + results.append([config, frame_size, result]) > + self.dut.send_expect("stop", "testpmd> ", 15) > + self.dut.send_expect("quit", "# ", 15) > + self.display_result(results) > + > + def test_perf_enable_multi_driver(self): > + self.perf_test() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + # resume setting > + if self.rx_desc_size =3D=3D 16: > + self.dut.build_install_dpdk(self.target) > + self.dut.kill_all() > -- > 2.34.1