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 506F4A09E7; Tue, 8 Dec 2020 08:51:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 25C3AC8F8; Tue, 8 Dec 2020 08:51:51 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6129B72DE for ; Tue, 8 Dec 2020 08:51:49 +0100 (CET) IronPort-SDR: ErG2lJVxUnsX6w7MqadyvDUqjzJDhCYQ5eFybF9j3rLQxBk8KCHX3bEub2FPK+Lht6zm9QqLo7 izKyZt0faoRw== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="173082730" X-IronPort-AV: E=Sophos;i="5.78,401,1599548400"; d="scan'208";a="173082730" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2020 23:51:47 -0800 IronPort-SDR: Bw6LttIoki29qrCq7czaD/QsUWLETgahJMwNYeFIVH1HE9HD75o9lJrt1+l0TsO/K1wxh8Gj7X mDKwSAWiX8mA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,401,1599548400"; d="scan'208";a="437285919" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2020 23:51:47 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 7 Dec 2020 23:51:46 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 7 Dec 2020 23:51:46 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 7 Dec 2020 23:51:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R+rU9+IVzCoHJfnpRUzeB0FnHsxaxFLTQt0sfZKX/+3mil+C2xnVH2msJKaEzpmw3sRtfqSzzf2OqVWWTrJuUW2hbRx+NyjTuszWZnpmXfWqE86LxbjEfNF4TY1trDIUrvK3agSDE4RfifAbOo6cCxRi4S/tBoaLbupBss34eAaDp+1Z00OtcqVBYFdewEN4aZ58jufy1fhllQocwOQHRHINdfyK9fbNwVnnM4Pa3TtNHJIKCl71oQLMA/vbyp1Q59EXYQs/QEfHpKXAUbUOAvRUiUXFXIuYP5sD1FDLVbRHhhDQWeRnHNePWjeI3NzgsZdTlKdaNjc+2AFCIJf5ew== 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-SenderADCheck; bh=QGX3TQH7+hc7VlvgZjZA+D7uv8S2wHDZfaAmquDxJu8=; b=HvHC5UUJUL4Oxs2KlA/wFFgCF3tmwIX3Ah/r3LnqSLV7rls2OAtU0HUEwELLo/THYz+PCf0uHuv9OG4h0LiVn2Yte+dGEg+Mzt1MpfYWrOkkbWJNCxpkCJYb6r8c1g62e0hJM5CxvR684rD7ZF3ZprXkWE0qf7yP2hHjvJgaMVOcvujbXRZ4bGoFlzIsZ6beAn0bY+eGm0ItPDV3FX0oCDxz4baGAa1NXOb82VzAUfdwwCRaxnZS22lnL4U+vSmF8yslCa6HgQNt8JJUJBa7Zw5BIIkMsHskhU0eh9N4Npw3+p4qDfb3fkWiOfvaF6qqiJ8JfCCvUydZ6uSPE057Eg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QGX3TQH7+hc7VlvgZjZA+D7uv8S2wHDZfaAmquDxJu8=; b=r0+mhgccgQ5VKJXIBARdgg9Pvt3qzKQku5ZCSuUs73PfjlsxTRJSrm2u3uik8zYOPW1NGQwDaGgBKcSHoQSBElJMHPOtauwV9WJVojdUJX4XX6gKargX3mbv89jSxAK0IGm1pWnEi2dNwilTUrE7/yI30XM7A0zc068V/PJTtlE= Received: from CO1PR11MB5058.namprd11.prod.outlook.com (2603:10b6:303:99::17) by MWHPR11MB1423.namprd11.prod.outlook.com (2603:10b6:300:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Tue, 8 Dec 2020 07:51:43 +0000 Received: from CO1PR11MB5058.namprd11.prod.outlook.com ([fe80::49f8:bbb1:6359:a683]) by CO1PR11MB5058.namprd11.prod.outlook.com ([fe80::49f8:bbb1:6359:a683%3]) with mapi id 15.20.3632.019; Tue, 8 Dec 2020 07:51:43 +0000 From: "Peng, Yuan" To: "Xie, WeiX" , "dts@dpdk.org" CC: "Xie, WeiX" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_cvl_vf_support_multicast_address:add cvl vf support multicast suite Thread-Index: AQHWzFhhW2bXsLrbiEi3UNtADEneaans1SQQ Date: Tue, 8 Dec 2020 07:51:42 +0000 Message-ID: References: <20201207052003.613-1-weix.xie@intel.com> In-Reply-To: <20201207052003.613-1-weix.xie@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 556b7f7e-0104-4f68-c319-08d89b4e1aaf x-ms-traffictypediagnostic: MWHPR11MB1423: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:813; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Wu3adBPvmj2hnq+3vSOvcjecpOk2zA3aXReRIqS1fxqb5EycFCpw+rEp5u8Dmpgz4jUdm9qzXk8QzHKFxoIRxpbam3e2spbZP6lKfK9ddDyIIc8ap99tJ58XAkez2z7quN26JNVDXPRXozcp1Vgu4Evs9Iw5fIUWQ0zf3JTXB9dirN39yNRCw1wJIEXpKBPqr1fuiDdmkdFMvuVNM+d8a69yNC1H6X5e6+dBlTW1WNefhpfduEFwbuBSvUkId2NDmyU3HqF3k6YSJ16Sm34VwxbNQyqmbjZWm9+ucc1AHGNedJ6B/7QEzt5tmaRHL2cU/DgG5P9luP2Jke34M5iY6g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB5058.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(376002)(396003)(346002)(136003)(4326008)(86362001)(5660300002)(83380400001)(9686003)(71200400001)(186003)(478600001)(33656002)(30864003)(316002)(110136005)(26005)(66946007)(7696005)(53546011)(52536014)(64756008)(76116006)(107886003)(55016002)(66556008)(66476007)(8936002)(6506007)(66446008)(2906002)(559001)(579004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?HdCzzn5ETg3qjNYWaexrq8Bmt5eQEWc+AMDs4vXllEmWpEzw1DqCf4VjOrnL?= =?us-ascii?Q?9bl+lDdc3UylyS0QqFZzBB+cLQu4lNsgc1ofHCPY7OxucrM4ENUaOp8EXFxI?= =?us-ascii?Q?xX9h1aPTVMnX9dOxjIJNX+Hb9wk+zRZMbfbWaUIkLcEcCzTj9CYyFSh9Kg98?= =?us-ascii?Q?uTPmKIU9CIY3zOdVnNyluCGRyYCOLgf9XPoEESQts4bNymcz4XKtUKdHBnjT?= =?us-ascii?Q?VDCzEamMUlBTkUHJzk3OYyICjN1iR3v0qd0U1XnNGtTjhkYzdJ10jhf3F3DR?= =?us-ascii?Q?0tFcShnfPq5dYvlpxmamTltxx2KztT9Zd8tiFGa9tK2/Nw780xMZuakx0MVd?= =?us-ascii?Q?Yf+8O/fIKBIxHOa5Q0syb57Yp6VSm7slKKzmHdtJbMn/jLe58SqBsz1vubDA?= =?us-ascii?Q?uwU31chM7tzJuoNNdY41JGn1WgUHTEkQgF46Dp42WhPUxP6epStn1l2limgn?= =?us-ascii?Q?Oaw7TTVuKDyXQz8XUtp+PYREM/daOEQfm7nwavF/62EnjMQMjvFZzhX948EU?= =?us-ascii?Q?HkVBCtQAhL2L5MoPNLNPlUlmKrudES+J9fDSrK4e1yIiMXGbqnmZdjCHSoiQ?= =?us-ascii?Q?RbcCTWGV9XfVHaUnFW8RQ9hXlK0pxFzeGI7KBwPqgUyjFQNf62+HTLu4Rfyr?= =?us-ascii?Q?gCKRG4E6vZF+ErVWg9ofOJkwGYQBgNteXTmBmrT58JwP9qiVKOnXzsi4Yd6F?= =?us-ascii?Q?AgW39dgJ/ln/LrUmqBAIKXdyc4EVw9FvMy3fOItpjeIs8BroxkPznSHZ0BO2?= =?us-ascii?Q?dzsfW+jTzL/ZvG7KoLu3t48R5lUd2Xb4NF0ElcifZTSbQG6E7WUkZMsn+3gh?= =?us-ascii?Q?PVNHSGzWgKMQOjLYdSTAdRA6hwRjzubY81lpg5lWvOrruDTbSg2CfrhFm+X8?= =?us-ascii?Q?JTF1vfJ4gzAvRndGHFKggKA6ks0dMypHxA/RxDpVdsVHZ+R1VV4KBDAXMWvF?= =?us-ascii?Q?AnP0c/6fzvf+0qQNFioVyMZPh/+pRIE0SM2jWGqmmjk=3D?= 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: CO1PR11MB5058.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 556b7f7e-0104-4f68-c319-08d89b4e1aaf X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2020 07:51:42.9380 (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: zSWdOvkHqjSWfiaeeabF/etqDgOwCucUYNkdNnQBGTFhgfXj7hrgA2wqvH6tlafgrGd5sZYtBYliIcSxvlm6pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1423 X-OriginatorOrg: intel.com Subject: Re: [dts] [PATCH V1] tests/TestSuite_cvl_vf_support_multicast_address:add cvl vf support multicast suite 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 Peng, Yuan -----Original Message----- From: dts On Behalf Of Xie wei Sent: Monday, December 7, 2020 1:20 PM To: dts@dpdk.org Cc: Xie, WeiX Subject: [dts] [PATCH V1] tests/TestSuite_cvl_vf_support_multicast_address:= add cvl vf support multicast suite *add new script about cvl vf support multicast. Signed-off-by: Xie wei --- ...tSuite_cvl_vf_support_multicast_address.py | 483 ++++++++++++++++++ 1 file changed, 483 insertions(+) create mode 100644 tests/TestSuite_cvl_vf_support_multicast_address.py diff --git a/tests/TestSuite_cvl_vf_support_multicast_address.py b/tests/Te= stSuite_cvl_vf_support_multicast_address.py new file mode 100644 index 00000000..1b148c6c --- /dev/null +++ b/tests/TestSuite_cvl_vf_support_multicast_address.py @@ -0,0 +1,483 @@ +# BSD LICENSE +# +# Copyright(c) 2020 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without #=20 +modification, are permitted provided that the following conditions #=20 +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 #=20 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #=20 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import re +from test_case import TestCase +from pmd_output import PmdOutput +from packet import Packet + +vf0_mac =3D "00:11:22:33:44:55" +vf1_mac =3D "00:11:22:33:44:66" +mul_mac_0 =3D "33:33:00:00:00:01" +mul_mac_1 =3D "33:33:00:40:10:01" +vf0_wrong_mac =3D "00:11:22:33:44:56" + +class TestCvlVfSupportMulticastAdress(TestCase): + + def set_up_all(self): + """ + Prerequisite steps for each test suite. + """ + self.dut_ports =3D self.dut.get_ports(self.nic) + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports for te= sting") + self.used_dut_port =3D self.dut_ports[0] + self.pf_interface =3D self.dut.ports_info[self.dut_ports[0]]['intf= '] + self.vf_flag =3D False + self.create_iavf() + self.pmd_output =3D PmdOutput(self.dut) + + localPort =3D self.tester.get_local_port(self.dut_ports[0]) + self.tester_itf =3D self.tester.get_interface(localPort) + + def set_up(self): + """ + Run before each test case. + """ + if self.running_case =3D=3D "test_maxnum_multicast_address_with_vf= s_trust_off": + # set two VFs trust off + self.dut.send_expect("ip link set dev %s vf 0 trust off" % sel= f.pf_interface, "# ") + self.dut.send_expect("ip link set dev %s vf 1 trust off" % sel= f.pf_interface, "# ") + else: + self.dut.send_expect("ip link set dev %s vf 0 trust on" % self= .pf_interface, "# ") + self.dut.send_expect("ip link set dev %s vf 1 trust on" % self= .pf_interface, "# ") + self.launch_testpmd() + + def create_iavf(self): + # Generate 2 VFs on PF + if self.vf_flag is False: + self.dut.bind_interfaces_linux('ice') + self.dut.generate_sriov_vfs_by_port(self.used_dut_port, 2) + self.sriov_vfs_port =3D self.dut.ports_info[self.used_dut_port= ]['vfs_port'] + self.vf_flag =3D True + + try: + for port in self.sriov_vfs_port: + port.bind_driver(self.drivername) + + self.dut.send_expect("ifconfig %s up" % self.pf_interface,= "# ") + self.dut.send_expect("ethtool --set-priv-flags %s vf-true-= promisc-support on" % self.pf_interface, "# ") + self.dut.send_expect("ip link set %s vf 0 mac %s" % (self.= pf_interface, vf0_mac), "# ") + self.dut.send_expect("ip link set %s vf 1 mac %s" % (self.= pf_interface, vf1_mac), "# ") + except Exception as e: + self.destroy_iavf() + raise Exception(e) + + def destroy_iavf(self): + if self.vf_flag is True: + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) + self.vf_flag =3D False + + def launch_testpmd(self): + param =3D "--portmask=3D0x3 --rxq=3D16 --txq=3D16" + self.pmd_output.start_testpmd(cores=3D"1S/4C/1T", param=3Dparam, p= orts=3D[self.sriov_vfs_port[0].pci, self.sriov_vfs_port[1].pci]) + self.pmd_output.execute_cmd("set fwd rxonly") + self.pmd_output.execute_cmd("set verbose 1") + self.pmd_output.execute_cmd("start") + self.pmd_output.execute_cmd("set promisc all off") + self.pmd_output.execute_cmd("set allmulti all off") + + def check_ports_multicast_address_number(self, num_0, num_1): + out_0 =3D self.pmd_output.execute_cmd("show port 0 mcast_macs") + number_0 =3D re.compile('Number of Multicast MAC address added:\s+= (.*?)\s+?').findall(out_0) + if not len(number_0): + number_0 =3D 0 + self.verify(number_0 =3D=3D num_0, 'configure multicast addres= s on port 0 failed') + else: + self.verify(int(number_0[0]) =3D=3D num_0, 'configure multicas= t address on port 0 failed') + out_1 =3D self.pmd_output.execute_cmd("show port 1 mcast_macs") + number_1 =3D re.compile('Number of Multicast MAC address added:\s+= (.*?)\s+?').findall(out_1) + if not len(number_1): + number_1 =3D 0 + self.verify(number_1 =3D=3D num_1, 'configure multicast addres= s on port 1 failed') + else: + self.verify(int(number_1[0]) =3D=3D num_1, 'configure multicas= t=20 + address on port 1 failed') + + def check_pkts_received(self): + out =3D self.pmd_output.get_output(timeout=3D1) + result =3D re.compile(r'port\s+(.*?)/queue.*?dst=3D(.*?)\s+').find= all(''.join(out.split('\n'))) + return result + + def config_mac(self, num_start, num_end): + list =3D [] + Mac_list =3D [] + for i in range(num_start, num_end): + list.append(hex(i)) + for j in list: + if j.startswith('0x'): + Mac_list.append('33:33:00:00:00:{}'.format((j[2:].upper())= .zfill(2))) + return Mac_list + + def config_pkts_and_send(self, num_start, num_end): + pkts =3D [] + mac_list =3D self.config_mac(num_start, num_end) + if num_end =3D=3D 17: + for i in range(0, num_end-1): + pkt =3D 'Ether(dst=3D"{}")/IP(src=3D"224.0.0.{}")/UDP(spor= t=3D22,dport=3D23)/("X"*480)'.format(mac_list[i], i+1) + pkts.append(pkt) + else: + for i in range(0, num_end): + pkt =3D 'Ether(dst=3D"{}")/IP(src=3D"224.0.0.{}")/UDP(spor= t=3D22,dport=3D23)/("X"*480)'.format(mac_list[i], i) + pkts.append(pkt) + pkt_last =3D 'Ether(dst=3D"33:33:00:00:00:{}")/IP(src=3D"224.0.0.{= }")/UDP(sport=3D22,dport=3D23)/("X"*480)'.format(hex(num_end)[2:], num_end) + pkts.append(pkt_last) + p =3D Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + + def test_one_multicast_address(self): + # send 4 packets + pkt1 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.0.0.1")/UDP(sport=3D22,d= port=3D23)/("X"*480)' % mul_mac_0 + pkt2 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.192.16.1")/UDP(sport=3D2= 2,dport=3D23)/("X"*480)' % mul_mac_1 + pkt3 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf0_mac + pkt4 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf1_mac + pkts =3D [pkt1, pkt2, pkt3, pkt4] + p =3D Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_1 =3D self.check_pkts_received() + self.verify(len(out_1) =3D=3D 2, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in out_1, "pkt3 can't be received by po= rt 0") + self.verify(('1', vf1_mac) in out_1, "pkt4 can't be received by=20 + port 1") + + # configure multicast address + self.pmd_output.execute_cmd("mcast_addr add 0 %s" % mul_mac_0) + self.check_ports_multicast_address_number(1, 0) + # send 4 packets + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_2 =3D self.check_pkts_received() + self.verify(len(out_2) =3D=3D 3, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in out_2, "pkt3 can't be received by po= rt 0") + self.verify(('1', vf1_mac) in out_2, "pkt4 can't be received by po= rt 1") + self.verify(('0', mul_mac_0) in out_2, "pkt1 can't be received=20 + by port 0") + + # remove the multicast address configuration + self.pmd_output.execute_cmd("mcast_addr remove 0 %s" % mul_mac_0) + self.check_ports_multicast_address_number(0, 0) + # send 4 packets + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_3 =3D self.check_pkts_received() + self.verify(len(out_3) =3D=3D 2, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in out_3, "pkt3 can't be received by po= rt 0") + self.verify(('1', vf1_mac) in out_3, "pkt4 can't be received by=20 + port 1") + + def test_two_multicast_address(self): + # configure multicast address + self.pmd_output.execute_cmd("mcast_addr add 0 %s" % mul_mac_0) + self.pmd_output.execute_cmd("mcast_addr add 0 %s" % mul_mac_1) + self.check_ports_multicast_address_number(2, 0) + + # send 4 packets + pkt1 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.0.0.1")/UDP(sport=3D22,d= port=3D23)/("X"*480)' % mul_mac_0 + pkt2 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.192.16.1")/UDP(sport=3D2= 2,dport=3D23)/("X"*480)' % mul_mac_1 + pkt3 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf0_mac + pkt4 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf1_mac + pkts =3D [pkt1, pkt2, pkt3, pkt4] + p =3D Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_1 =3D self.check_pkts_received() + self.verify(len(out_1) =3D=3D 4, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in out_1, "pkt3 can't be received by po= rt 0") + self.verify(('1', vf1_mac) in out_1, "pkt4 can't be received by po= rt 1") + self.verify(('0', mul_mac_0) in out_1 and ('0', mul_mac_1) in=20 + out_1, "pkt1-2 can't be received by port 0") + + # remove the multicast address configuration + self.pmd_output.execute_cmd("mcast_addr remove 0 %s" % mul_mac_0) + self.check_ports_multicast_address_number(1, 0) + # send 4 packets + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_2 =3D self.check_pkts_received() + self.verify(len(out_2) =3D=3D 3, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in out_2, "pkt3 can't be received by po= rt 0") + self.verify(('1', vf1_mac) in out_2, "pkt4 can't be received by po= rt 1") + self.verify(('0', mul_mac_1) in out_2, "pkt2 can't be received=20 + by port 0") + + def test_multicast_address_on_two_vf_ports(self): + # configure multicast address on port 0 and port 1 + self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:00:00:01") + self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:00:00:01") + self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:00:00:02") + self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:00:00:03") + self.check_ports_multicast_address_number(2, 2) + + # send 3 packets + pkt1 =3D 'Ether(dst=3D"33:33:00:00:00:01")/IP(src=3D"224.0.0.1")/U= DP(sport=3D22,dport=3D23)/("X"*480)' + pkt2 =3D 'Ether(dst=3D"33:33:00:00:00:02")/IP(src=3D"224.0.0.2")/U= DP(sport=3D22,dport=3D23)/("X"*480)' + pkt3 =3D 'Ether(dst=3D"33:33:00:00:00:03")/IP(src=3D"224.0.0.3")/U= DP(sport=3D22,dport=3D23)/("X"*480)' + pkts =3D [pkt1, pkt2, pkt3] + p =3D Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_1 =3D self.check_pkts_received() + self.verify(len(out_1) =3D=3D 4, "Wrong number of pkts received") + self.verify(('0', "33:33:00:00:00:01") in out_1, "pkt1 can't be re= ceived by port 0") + self.verify(('1', "33:33:00:00:00:01") in out_1, "pkt1 can't be re= ceived by port 1") + self.verify(('0', "33:33:00:00:00:02") in out_1, "pkt2 can't be re= ceived by port 0") + self.verify(('1', "33:33:00:00:00:03") in out_1, "pkt3 can't be=20 + received by port 1") + + # remove some multicast address configurations + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:01= ") + self.pmd_output.execute_cmd("mcast_addr remove 1 33:33:00:00:00:03= ") + self.check_ports_multicast_address_number(1, 1) + # send 3 packets + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + out_2 =3D self.check_pkts_received() + self.verify(len(out_2) =3D=3D 2, "Wrong number of pkts received") + self.verify(('1', "33:33:00:00:00:01") in out_2, "pkt1 can't be re= ceived by port 1") + self.verify(('0', "33:33:00:00:00:02") in out_2, "pkt2 can't be=20 + received by port 0") + + def test_maxnum_multicast_address_with_vfs_trust_off(self): + # configure 16 multicast address on port 0 and port 1 + mac_addr_list =3D self.config_mac(1, 17) + for i in mac_addr_list: + self.pmd_output.execute_cmd("mcast_addr add 0 %s" % i) + self.pmd_output.execute_cmd("mcast_addr add 1 %s" % i) + self.check_ports_multicast_address_number(16, 16) + + # configure one more multicast address on port 0 and port 1 + out_0 =3D self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:0= 0:00:11") + self.verify('rte_eth_dev_set_mc_addr_list(port=3D0, nb=3D17) faile= d' in out_0, 'Configure one more multicast address on port 0 successfullly'= ) + out_1 =3D self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:0= 0:00:11") + self.verify('rte_eth_dev_set_mc_addr_list(port=3D1, nb=3D17) faile= d' in out_1, 'Configure one more multicast address on port 1 successfullly'= ) + self.check_ports_multicast_address_number(16, 16) + # send packets + self.config_pkts_and_send(1, 17) + output_1 =3D self.check_pkts_received() + self.verify(len(output_1) =3D=3D 32, "Wrong number of pkts receive= d") + self.verify(('0', "33:33:00:00:00:11") not in output_1, "pkt last = can be received by port 0") + self.verify(('1', "33:33:00:00:00:11") not in output_1, "pkt last = can be received by port 1") + for i in range(len(mac_addr_list)): + self.verify(('0', mac_addr_list[i]) in output_1, "pkt%s can't = be received by port 0" % (i+1)) + self.verify(('1', mac_addr_list[i]) in output_1, "pkt%s=20 + can't be received by port 1" % (i+1)) + + # remove one multicast address on port 0 + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:0B= ") + self.pmd_output.execute_cmd("mcast_addr remove 1 33:33:00:00:00:01= ") + self.check_ports_multicast_address_number(15, 15) + self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:00:00:11") + self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:00:00:11") + self.check_ports_multicast_address_number(16, 16) + # send packts + self.config_pkts_and_send(1, 17) + output_2 =3D self.check_pkts_received() + self.verify(len(output_2) =3D=3D 32, "Wrong number of pkts receive= d") + for i in range(len(mac_addr_list)): + if mac_addr_list[i] =3D=3D '33:33:00:00:00:0B': + self.verify(('0', "33:33:00:00:00:0B") not in output_2, "p= kt11 can be received by port 0") + self.verify(('1', "33:33:00:00:00:0B") in output_2, "pkt11= can't be received by port 1") + elif mac_addr_list[i] =3D=3D '33:33:00:00:00:01': + self.verify(('1', "33:33:00:00:00:01") not in output_2, "p= kt1 can be received by port 1") + self.verify(('0', "33:33:00:00:00:01") in output_2, "pkt1 = can't be received by port 0") + else: + self.verify(('0', mac_addr_list[i]) in output_2, "pkt%s ca= n't be received by port 0" % (i+1)) + self.verify(('1', mac_addr_list[i]) in output_2, "pkt%s=20 + can't be received by port 1" % (i+1)) + + # remove all the multicast address configuration on two ports + for i in mac_addr_list: + self.pmd_output.execute_cmd("mcast_addr remove 0 %s" % i) + self.pmd_output.execute_cmd("mcast_addr remove 1 %s" % i) + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:11= ") + self.pmd_output.execute_cmd("mcast_addr remove 1 33:33:00:00:00:11= ") + self.check_ports_multicast_address_number(0, 0) + # send packts + self.config_pkts_and_send(1, 17) + output_3 =3D self.check_pkts_received() + self.verify(len(output_3) =3D=3D 0, "Wrong number of pkts=20 + received") + + def test_maxnum_multicast_address_with_vfs_trust_on(self): + # configure 64 multicast address on port 0 and port 1 + mac_addr_list =3D self.config_mac(0, 64) + for i in mac_addr_list: + self.pmd_output.execute_cmd("mcast_addr add 0 %s" % i) + self.pmd_output.execute_cmd("mcast_addr add 1 %s" % i) + self.check_ports_multicast_address_number(64, 64) + + # configure one more multicast address on each port + out_0 =3D self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:0= 0:00:40") + self.verify('rte_eth_dev_set_mc_addr_list(port=3D0, nb=3D65) faile= d' in out_0, 'Configure one more multicast address on port 0 successfullly'= ) + out_1 =3D self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:0= 0:00:40") + self.verify('rte_eth_dev_set_mc_addr_list(port=3D1, nb=3D65) faile= d' in out_1, 'Configure one more multicast address on port 1 successfullly'= ) + self.check_ports_multicast_address_number(64, 64) + + # send packets + self.config_pkts_and_send(0, 64) + output_1 =3D self.check_pkts_received() + self.verify(len(output_1) =3D=3D 128, "Wrong number of pkts receiv= ed") + self.verify(('0', "33:33:00:00:00:40") not in output_1, "pkt last = can be received by port 0") + self.verify(('1', "33:33:00:00:00:40") not in output_1, "pkt lsat = can be received by port 1") + for i in range(len(mac_addr_list)): + self.verify(('0', mac_addr_list[i]) in output_1, "pkt%s can't = be received by port 0" % i) + self.verify(('1', mac_addr_list[i]) in output_1, "pkt%s=20 + can't be received by port 1" % i) + + # remove one multicast address on port 0 + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:0B= ") + self.pmd_output.execute_cmd("mcast_addr remove 1 33:33:00:00:00:01= ") + self.check_ports_multicast_address_number(63, 63) + self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:00:00:40") + self.pmd_output.execute_cmd("mcast_addr add 1 33:33:00:00:00:40") + self.check_ports_multicast_address_number(64, 64) + + # send packts + self.config_pkts_and_send(0, 64) + output_2 =3D self.check_pkts_received() + self.verify(len(output_2) =3D=3D 128, "Wrong number of pkts receiv= ed") + for i in range(len(mac_addr_list)): + if mac_addr_list[i] =3D=3D '33:33:00:00:00:0B': + self.verify(('0', "33:33:00:00:00:0B") not in output_2, "p= kt11 can be received by port 0") + self.verify(('1', "33:33:00:00:00:0B") in output_2, "pkt11= can't be received by port 1") + elif mac_addr_list[i] =3D=3D '33:33:00:00:00:01': + self.verify(('1', "33:33:00:00:00:01") not in output_2, "p= kt1 can be received by port 1") + self.verify(('0', "33:33:00:00:00:01") in output_2, "pkt1 = can't be received by port 0") + else: + self.verify(('0', mac_addr_list[i]) in output_2, "pkt%s ca= n't be received by port 0" % i) + self.verify(('1', mac_addr_list[i]) in output_2, "pkt%s=20 + can't be received by port 1" % i) + + # remove all the multicast address configuration on port 0 + for i in mac_addr_list: + self.pmd_output.execute_cmd("mcast_addr remove 0 %s" % i) + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:40= ") + self.check_ports_multicast_address_number(0, 64) + # send packts + self.config_pkts_and_send(0, 64) + output_3 =3D self.check_pkts_received() + self.verify(len(output_3) =3D=3D 64, "Wrong number of pkts receive= d") + for i in range(len(mac_addr_list)): + self.verify(('0', mac_addr_list[i]) not in output_3, "pkt%s=20 + can be received by port 0" % i) + + # remove all the multicast address configuration on port 1 + for i in mac_addr_list: + self.pmd_output.execute_cmd("mcast_addr remove 1 %s" % i) + self.pmd_output.execute_cmd("mcast_addr remove 1 33:33:00:00:00:40= ") + self.check_ports_multicast_address_number(0, 0) + # send packts + self.config_pkts_and_send(0, 64) + output_4 =3D self.check_pkts_received() + self.verify(len(output_4) =3D=3D 0, "Wrong number of pkts=20 + received") + + def test_set_allmulti_on(self): + # set allmulti on and promisc off + self.pmd_output.execute_cmd("set promisc all off") + self.pmd_output.execute_cmd("set allmulti all on") + + # send 5 packets + pkt1 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.0.0.1")/UDP(sport=3D22,d= port=3D23)/("X"*480)' % mul_mac_0 + pkt2 =3D 'Ether(dst=3D"%s")/IP(src=3D"224.192.16.1")/UDP(sport=3D2= 2,dport=3D23)/("X"*480)' % mul_mac_1 + pkt3 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf0_mac + pkt4 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf1_mac + pkt5 =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1")/UDP(sport=3D22= ,dport=3D23)/("X"*480)' % vf0_wrong_mac + pkts =3D [pkt1, pkt2, pkt3, pkt4, pkt5] + p =3D Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_1 =3D self.check_pkts_received() + self.verify(len(output_1) =3D=3D 6, "Wrong number of pkts received= ") + self.verify(('0', vf0_mac) in output_1, "pkt3 can't be received by= port 0") + self.verify(('1', vf1_mac) in output_1, "pkt4 can't be received by= port 1") + self.verify(('0', mul_mac_0) in output_1 and ('0', mul_mac_1) in o= utput_1, "pkt1-2 can't be received by port 0") + self.verify(('1', mul_mac_0) in output_1 and ('1', mul_mac_1)=20 + in output_1, "pkt1-2 can't be received by port 1") + + # set allmulti off and promisc on + self.pmd_output.execute_cmd("set promisc all on") + self.pmd_output.execute_cmd("set allmulti all off") + # send 5 packets + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_2 =3D self.check_pkts_received() + self.verify(len(output_2) =3D=3D 6, "Wrong number of pkts received= ") + self.verify(('0', vf0_mac) in output_2 and ('0', vf1_mac) in outpu= t_2 and ('0', vf0_wrong_mac) in output_2, "pkt3-5 can't be received by port= 0") + self.verify(('1', vf0_mac) in output_2 and ('1', vf1_mac) in=20 + output_2 and ('1', vf0_wrong_mac) in output_2, "pkt3-5 can't be=20 + received by port 1") + + def test_negative_case(self): + # send one packet + p =3D Packet() + p.append_pkt('Ether(dst=3D"33:33:00:00:00:40")/IP(src=3D"224.0.0.1= ")/UDP(sport=3D22,dport=3D23)/("X"*480)') + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_1 =3D self.check_pkts_received() + self.verify(len(output_1) =3D=3D 0, "Wrong number of pkts=20 + received") + + # add a multicast address + self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:00:00:40") + # send one packet + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_2 =3D self.check_pkts_received() + self.verify(len(output_2) =3D=3D 1, "Wrong number of pkts received= ") + self.verify(('0', "33:33:00:00:00:40") in output_2, "pkt can't=20 + be received by port 0") + + # add a same multicast address + result =3D self.pmd_output.execute_cmd("mcast_addr add 0 33:33:00:= 00:00:40") + self.verify('multicast address already filtered by port' in result= , "add a same multicast address successfully") + # send one packet + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_3 =3D self.check_pkts_received() + self.verify(len(output_3) =3D=3D 1, "Wrong number of pkts received= ") + self.verify(('0', "33:33:00:00:00:40") in output_3, "pkt can't=20 + be received by port 0") + + # remove nonexistent multicast address + result =3D self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:= 00:00:00:41") + self.verify('multicast address not filtered by port 0' in result, = "remove nonexistent multicast address successfully") + # send one packet + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_4 =3D self.check_pkts_received() + self.verify(len(output_4) =3D=3D 1, "Wrong number of pkts received= ") + self.verify(('0', "33:33:00:00:00:40") in output_4, "pkt can't=20 + be received by port 0") + + # add wrong multicast address + result =3D self.pmd_output.execute_cmd("mcast_addr add 0 32:33:00:= 00:00:41") + self.verify('Invalid multicast addr 32:33:00:00:00:41' in result, = "add wrong multicast address successfully") + # send one packet + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_5 =3D self.check_pkts_received() + self.verify(len(output_5) =3D=3D 1, "Wrong number of pkts received= ") + self.verify(('0', "33:33:00:00:00:40") in output_5, "pkt can't=20 + be received by port 0") + + # remove the multicast address + self.pmd_output.execute_cmd("mcast_addr remove 0 33:33:00:00:00:40= ") + # send one packet + p.send_pkt(self.tester, tx_port=3Dself.tester_itf) + output_6 =3D self.check_pkts_received() + self.verify(len(output_6) =3D=3D 0, "Wrong number of pkts=20 + received") + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.send_expect("quit", "# ", 30) + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.kill_all() + self.destroy_iavf() -- 2.17.1