From patchwork Thu Mar 11 15:38:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xie, WeiX" X-Patchwork-Id: 88925 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67C36A056A; Thu, 11 Mar 2021 08:12:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31B8222A345; Thu, 11 Mar 2021 08:12:18 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 1B5DB40689 for ; Thu, 11 Mar 2021 08:12:15 +0100 (CET) IronPort-SDR: hZtru+sNlnlxmQQEgnzDVfrvKmw1KaxTXDsmx36dcjdGDv1Bu/RipgbxAv/8DeGwAWLbQszl4S 1i8v1f4OGKkA== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="273664305" X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="273664305" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 23:12:15 -0800 IronPort-SDR: 6VF63emu7801tK9rgoF3vjoCL2Qs/AxVL/iE0jRvpSZGX5cyui9mFR5JfrnWDrUsEZGSmGshPD wdzpAWLeGzLw== X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="410510501" Received: from unknown (HELO localhost.localdomain) ([10.240.183.103]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 23:12:13 -0800 From: xiewei To: dts@dpdk.org Cc: xiewei Date: Thu, 11 Mar 2021 23:38:05 +0800 Message-Id: <20210311153805.1297-1-weix.xie@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] tests/cvl_vf_support_multicast_address: add vlan packet check 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 Sender: "dts" a) add vlan packet check when set allmulti on b) add a new test case: add vlan filter check when set allmulti off and configured multicast address Signed-off-by: xiewei Tested-by: Xie Wei Signed-off-by: xiewei --- ...tSuite_cvl_vf_support_multicast_address.py | 75 ++++++++++++++++--- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/tests/TestSuite_cvl_vf_support_multicast_address.py b/tests/TestSuite_cvl_vf_support_multicast_address.py index 1b148c6c..dd241a82 100644 --- a/tests/TestSuite_cvl_vf_support_multicast_address.py +++ b/tests/TestSuite_cvl_vf_support_multicast_address.py @@ -393,21 +393,23 @@ class TestCvlVfSupportMulticastAdress(TestCase): # send 5 packets pkt1 = 'Ether(dst="%s")/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0 - pkt2 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1 - pkt3 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_mac - pkt4 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf1_mac - pkt5 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_wrong_mac - pkts = [pkt1, pkt2, pkt3, pkt4, pkt5] + pkt2 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0 + pkt3 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1 + pkt4 = 'Ether(dst="%s")/Dot1Q(vlan=2)/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1 + pkt5 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_mac + pkt6 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf1_mac + pkt7 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_wrong_mac + pkts = [pkt1, pkt2, pkt3, pkt4, pkt5, pkt6, pkt7] p = Packet() for i in pkts: p.append_pkt(i) p.send_pkt(self.tester, tx_port=self.tester_itf) output_1 = self.check_pkts_received() - self.verify(len(output_1) == 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 output_1, "pkt1-2 can't be received by port 0") - self.verify(('1', mul_mac_0) in output_1 and ('1', mul_mac_1) in output_1, "pkt1-2 can't be received by port 1") + self.verify(len(output_1) == 10, "Wrong number of pkts received") + self.verify(('0', vf0_mac) in output_1, "pkt5 can't be received by port 0") + self.verify(('1', vf1_mac) in output_1, "pkt6 can't be received by port 1") + self.verify(('0', mul_mac_0) in output_1 and ('0', mul_mac_1) in output_1, "pkt1-4 can't be received by port 0") + self.verify(('1', mul_mac_0) in output_1 and ('1', mul_mac_1) in output_1, "pkt1-4 can't be received by port 1") # set allmulti off and promisc on self.pmd_output.execute_cmd("set promisc all on") @@ -416,8 +418,8 @@ class TestCvlVfSupportMulticastAdress(TestCase): p.send_pkt(self.tester, tx_port=self.tester_itf) output_2 = self.check_pkts_received() self.verify(len(output_2) == 6, "Wrong number of pkts received") - self.verify(('0', vf0_mac) in output_2 and ('0', vf1_mac) in output_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 output_2 and ('1', vf0_wrong_mac) in output_2, "pkt3-5 can't be received by port 1") + self.verify(('0', vf0_mac) in output_2 and ('0', vf1_mac) in output_2 and ('0', vf0_wrong_mac) in output_2, "pkt5-7 can't be received by port 0") + self.verify(('1', vf0_mac) in output_2 and ('1', vf1_mac) in output_2 and ('1', vf0_wrong_mac) in output_2, "pkt5-7 can't be received by port 1") def test_negative_case(self): # send one packet @@ -469,6 +471,55 @@ class TestCvlVfSupportMulticastAdress(TestCase): output_6 = self.check_pkts_received() self.verify(len(output_6) == 0, "Wrong number of pkts received") + def test_set_vlan_filter_on(self): + # send 4 packets + pkt1 = 'Ether(dst="%s")/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0 + pkt2 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0 + pkt3 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1 + pkt4 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1 + pkts = [pkt1, pkt2, pkt3, pkt4] + p = Packet() + for i in pkts: + p.append_pkt(i) + p.send_pkt(self.tester, tx_port=self.tester_itf) + out_1 = self.check_pkts_received() + self.verify(len(out_1) == 0, "pkt1-4 can be received by any port") + + # 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=self.tester_itf) + out_2 = self.check_pkts_received() + self.verify(len(out_2) == 1, "Wrong number of pkts received") + self.verify(('0', mul_mac_0) in out_2, "pkt1 can't be received by port 0") + + # set vlan filter on + self.pmd_output.execute_cmd("vlan set filter on 0") + self.pmd_output.execute_cmd("rx_vlan add 1 0") + # send 4 packets + p.send_pkt(self.tester, tx_port=self.tester_itf) + out_3 = self.check_pkts_received() + self.verify(len(out_3) == 2, "Wrong number of pkts received") + self.verify(('0', mul_mac_0) in out_3, "pkt1-2 can't be received by port 0") + self.verify(('0', mul_mac_1) not in out_3, "other pkt can be received by port 0") + + # remove the vlan filter + self.pmd_output.execute_cmd("rx_vlan rm 1 0") + # send 4 packets + p.send_pkt(self.tester, tx_port=self.tester_itf) + out_4 = self.check_pkts_received() + self.verify(len(out_4) == 1, "Wrong number of pkts received") + self.verify(('0', mul_mac_0) in out_4, "pkt1 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(0, 0) + # send 4 packets + p.send_pkt(self.tester, tx_port=self.tester_itf) + out_5 = self.check_pkts_received() + self.verify(len(out_5) == 0, "pkt1-4 can be received by any port") + def tear_down(self): """ Run after each test case.