From: <pvukkisala@marvell.com>
To: <dts@dpdk.org>
Cc: <avijay@marvell.com>, <fmasood@marvell.com>,
Phanendra Vukkisala <pvukkisala@marvell.com>
Subject: [dts] [PATCH] ptype_mapping: Add support to run 'get test' on cavium devices
Date: Mon, 9 Sep 2019 18:53:41 +0530 [thread overview]
Message-ID: <1568035421-32446-1-git-send-email-pvukkisala@marvell.com> (raw)
From: Phanendra Vukkisala <pvukkisala@marvell.com>
Modified commands and output according implementation for cavium platform for cavium devices
Signed-off-by: Phanendra Vukkisala <pvukkisala@marvell.com>
---
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
next reply other threads:[~2019-09-09 13:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 13:23 pvukkisala [this message]
2019-09-18 10:35 ` Tu, Lijuan
2019-09-20 6:22 ` Li, WenjieX A
2019-09-20 16:26 ` Phanendra Vukkisala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1568035421-32446-1-git-send-email-pvukkisala@marvell.com \
--to=pvukkisala@marvell.com \
--cc=avijay@marvell.com \
--cc=dts@dpdk.org \
--cc=fmasood@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).