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 EA343A2EE1 for ; Mon, 9 Sep 2019 15:23:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B3D7D1EB5F; Mon, 9 Sep 2019 15:23:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 299981E9BC for ; Mon, 9 Sep 2019 15:23:52 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x89DGfW3022010 for ; Mon, 9 Sep 2019 06:23:51 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=KQIAS573vT1tBXLTHkAbSX7fV/ImBcac1SLoMRax5EY=; b=T0o73FXr2VijM2pe9XaUouFEh5m5qea3HafCLs1QGwFqiyS/jldlD4pxs6/onxOQ8Qyf H1V/zT3/PSIqN/rMJ0zCQuFSVB+6JqjSsL6aQia7KQg5CIGjaQ3wSLtaY4KAAPFGjDnL BkAdQp2MbzSVVO5+xpj7AB2hAKBmbQjxjIXHTYDrabtbVHKX1PXdMurT+KQm4bs5k71E kFIsrVPsFhpO+nEyeJ17I25tY0nHseJowDNYJihlPHE1w2rUpQhdxXVByiRECoB00Ho4 bAjt7I7d9jDKdM+HN4WfIlvJc5vGoU/x/zOwhchqp7njzoP9RcrM4C05yOGtnQ4S7cuT qw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2uvc2jf0by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 09 Sep 2019 06:23:51 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Sep 2019 06:23:49 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 9 Sep 2019 06:23:49 -0700 Received: from phanendra-system.marvell.com (unknown [10.28.11.20]) by maili.marvell.com (Postfix) with ESMTP id EE04D3F7040; Mon, 9 Sep 2019 06:23:47 -0700 (PDT) From: To: CC: , , Phanendra Vukkisala Date: Mon, 9 Sep 2019 18:53:41 +0530 Message-ID: <1568035421-32446-1-git-send-email-pvukkisala@marvell.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-09_05:2019-09-09,2019-09-09 signatures=0 Subject: [dts] [PATCH] ptype_mapping: Add support to run 'get test' on cavium devices 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" From: Phanendra Vukkisala Modified commands and output according implementation for cavium platform for cavium devices Signed-off-by: Phanendra Vukkisala --- tests/TestSuite_ptype_mapping.py | 122 +++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 40 deletions(-) diff --git a/tests/TestSuite_ptype_mapping.py b/tests/TestSuite_ptype_mapping.py index d7af657..8b8306c 100644 --- a/tests/TestSuite_ptype_mapping.py +++ b/tests/TestSuite_ptype_mapping.py @@ -45,21 +45,23 @@ class TestPtype_Mapping(TestCase): Run at the start of each test suite. """ self.verify(self.nic in ['fortville_eagle', 'fortville_spirit', - 'fortville_spirit_single', 'fortville_25g', 'fortpark_TLV', 'carlsville'], + 'fortville_spirit_single', 'fortville_25g', 'fortpark_TLV', 'carlsville', 'cavium_a063', 'cavium_a064'], 'ptype mapping test can not support %s nic' % self.nic) ports = self.dut.get_ports() - self.verify(len(ports) >= 1, "Insufficient ports for testing") + self.verify(len(ports) >= 1, "Insufficient ports for testing") valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] self.dut_port = valports[0] tester_port = self.tester.get_local_port(self.dut_port) self.tester_iface = self.tester.get_interface(tester_port) - self.dut.send_expect("sed -i -e '" +\ - "/printf(\" - VLAN tci=0x%x\", mb->vlan_tci);" +\ - "/a\\\\t\\tprintf(\" - pktype: 0x%x\", mb->packet_type);'" +\ - " app/test-pmd/util.c", "# ", 30, verify = True) - self.dut.build_install_dpdk(self.dut.target) - + if self.nic not in ["cavium_a063", "cavium_a064"]: + self.dut.send_expect("sed -i -e '" +\ + "/printf(\" - VLAN tci=0x%x\", mb->vlan_tci);" +\ + "/a\\\\t\\tprintf(\" - pktype: 0x%x\", mb->packet_type);'" +\ + " app/test-pmd/util.c", "# ", 30, verify = True) + + self.dut.build_install_dpdk(self.dut.target) + def set_up(self): """ @@ -83,16 +85,17 @@ class TestPtype_Mapping(TestCase): else: pkt_names = pkt_types[pkt_type] pkt = Packet(pkt_type=pkt_type) - pkt.send_pkt(tx_port=self.tester_iface) + pkt.send_pkt(tx_port=self.tester_iface,count=4) out = self.dut.get_session_output(timeout=2) - self.verify(sw_ptype in out, - "Failed to detect correct ptype value") + if sw_ptype != None: + self.verify(sw_ptype in out, + "Failed to detect correct ptype value") for pkt_layer_name in pkt_names: if pkt_layer_name not in out: print utils.RED("Fail to detect %s" % pkt_layer_name) raise VerifyFailure("Failed to detect %s" % pkt_layer_name) print utils.GREEN("Detected %s successfully" % pkt_type) - + def strip_ptype(self, table, hw_ptype): """ Strip software packet type from packet mapping table. @@ -113,35 +116,73 @@ class TestPtype_Mapping(TestCase): """ Get ptype mapping table and run ptype test. """ - out = self.dut_testpmd.execute_cmd('ptype mapping get 0 0') - time.sleep(3) - self.verify("255" in out, - "Failed to get 255 items ptype mapping table!!!") - out = self.dut_testpmd.execute_cmd('ptype mapping get 0 1') - time.sleep(3) - self.verify("166" in out, - "Failed to get 166 items ptype mapping table!!!") - sw_ptype = self.strip_ptype(out, hw_ptype) - if hw_ptype == 38: + if self.nic in ["cavium_a063", "cavium_a064"]: + out = self.dut_testpmd.execute_cmd('show port 0 ptypes') + ptype_list = ["L2_ETHER", "L3_IPV4", "INNER_L3_IPV6", "INNER_L4_UDP", "TUNNEL_GRE", "TUNNEL_NVGRE", "TUNNEL_GENEVE", "TUNNEL_VXLAN"] + for ptype in ptype_list : + self.verify( ptype in out, "Failed to get ptype: %s"%(ptype)) pktType = { - "MAC_IP_IPv6_UDP_PKT": - ["L2_ETHER", "L3_IPV4_EXT_UNKNOWN", - "TUNNEL_IP", "INNER_L3_IPV6_EXT_UNKNOWN", + "MAC_IP_IPv6_UDP_PKT": + ["L2_ETHER", "L3_IPV4", + "TUNNEL_IP", "INNER_L3_IPV6", "INNER_L4_UDP"] } - elif hw_ptype == 75: + self.run_test(None, pktType, check_ptype) pktType = { - "MAC_IP_NVGRE_MAC_VLAN_IP_PKT": - ["L2_ETHER", "L3_IPV4_EXT_UNKNOWN", - "TUNNEL_GRENAT", "INNER_L2_ETHER_VLAN", - "INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_NONFRAG"] - } - self.run_test(sw_ptype, pktType, check_ptype) - + "MAC_IP_NVGRE_MAC_VLAN_IP_UDP_PKT": + ["L2_ETHER", "L3_IPV4", + "TUNNEL_NVGRE", "INNER_L2_ETHER_VLAN", + "INNER_L3_IPV4", "INNER_L4_UDP"] + } + self.run_test(None, pktType, check_ptype) + pktType = { + "MAC_IP_UDP_VXLAN_MAC_IP_UDP_PKT": + ["L2_ETHER", "L3_IPV4", + "TUNNEL_VXLAN", + "INNER_L3_IPV4", "INNER_L4_UDP"] + } + self.run_test(None, pktType, check_ptype) + pktType = { + "MAC_IP_UDP_GENEVE_MAC_IP_UDP_PKT": + ["L2_ETHER", "L3_IPV4", + "TUNNEL_GENEVE", + "INNER_L3_IPV4", "INNER_L4_UDP"] + } + self.run_test(None, pktType, check_ptype) + else: + out = self.dut_testpmd.execute_cmd('ptype mapping get 0 0') + time.sleep(3) + self.verify("255" in out, + "Failed to get 255 items ptype mapping table!!!") + out = self.dut_testpmd.execute_cmd('ptype mapping get 0 1') + time.sleep(3) + self.verify("166" in out, + "Failed to get 166 items ptype mapping table!!!") + sw_ptype = self.strip_ptype(out, hw_ptype) + sw_ptype = None + if hw_ptype == 38: + pktType = { + "MAC_IP_IPv6_UDP_PKT": + ["L2_ETHER", "L3_IPV4_EXT_UNKNOWN", + "TUNNEL_IP", "INNER_L3_IPV6_EXT_UNKNOWN", + "INNER_L4_UDP"] + } + elif hw_ptype == 75: + pktType = { + "MAC_IP_NVGRE_MAC_VLAN_IP_UDP_PKT": + ["L2_ETHER", "L3_IPV4_EXT_UNKNOWN", + "TUNNEL_GRENAT", "INNER_L2_ETHER_VLAN", + "INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_NONFRAG"] + } + self.run_test(sw_ptype, pktType, check_ptype) + def ptype_mapping_test(self, check_ptype = None): - - self.run_ptype_test(hw_ptype = 38, check_ptype = check_ptype) - self.run_ptype_test(hw_ptype = 75, check_ptype = check_ptype) + + if self.nic in ["cavium_a063", "cavium_a064"]: + self.run_ptype_test(hw_ptype = None, check_ptype = check_ptype) + else: + self.run_ptype_test(hw_ptype = 38, check_ptype = check_ptype) + self.run_ptype_test(hw_ptype = 75, check_ptype = check_ptype) def test_ptype_mapping_get(self): @@ -149,7 +190,7 @@ class TestPtype_Mapping(TestCase): Get hardware defined ptype to software defined ptype mapping items. """ self.ptype_mapping_test() - + def test_ptype_mapping_reset(self): """ Reset packet mapping table after changing table. @@ -230,7 +271,8 @@ class TestPtype_Mapping(TestCase): """ Run after each test suite. """ - self.dut.send_expect("sed -i '/printf(\" - pktype: 0x%x\", " +\ - "mb->packet_type);/d' app/test-pmd/util.c", "# ", 30, verify = True) - self.dut.build_install_dpdk(self.dut.target) + if self.nic not in ["cavium_a063", "cavium_a064"]: + self.dut.send_expect("sed -i '/printf(\" - pktype: 0x%x\", " +\ + "mb->packet_type);/d' app/test-pmd/util.c", "# ", 30, verify = True) + self.dut.build_install_dpdk(self.dut.target) self.dut.kill_all() -- 1.7.9.5