From: "Pei, Yulong" <yulong.pei@intel.com>
To: "Tu, LijuanX A" <lijuanx.a.tu@intel.com>,
"dts@dpdk.org" <dts@dpdk.org>, "Xu, Qian Q" <qian.q.xu@intel.com>
Subject: Re: [dts] [PATCH v2]tests: add checksum offload and tso test scripts test_plans: add test plan for checksum offload and tso
Date: Mon, 22 Feb 2016 05:52:19 +0000 [thread overview]
Message-ID: <188971FCDA171749BED5DA74ABF3E6F0035301FC@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1455773760-2336-1-git-send-email-lijuanx.a.tu@intel.com>
Hi Lijuan,
1. I only saw "checksum on the transmit packet" test, where is "checksum on the receive packet" test ?
2. where is tso test plan ?
Best Regards
Yulong Pei
-----Original Message-----
From: Tu, LijuanX A
Sent: Thursday, February 18, 2016 1:36 PM
To: dts@dpdk.org; Xu, Qian Q <qian.q.xu@intel.com>; Pei, Yulong <yulong.pei@intel.com>
Cc: Lijuan Tu <lijuanx.tu.a@intel.com>; Tu, LijuanX A <lijuanx.a.tu@intel.com>
Subject: [dts][PATCH v2]tests: add checksum offload and tso test scripts test_plans: add test plan for checksum offload and tso
From: Lijuan Tu <lijuanx.tu.a@intel.com>
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
test_plans/vf_offload.rst | 178 ++++++++++++++++++++
tests/TestSuite_vf_offload.py | 369 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 547 insertions(+)
create mode 100644 test_plans/vf_offload.rst create mode 100644 tests/TestSuite_vf_offload.py
diff --git a/test_plans/vf_offload.rst b/test_plans/vf_offload.rst new file mode 100644 index 0000000..38956e6
--- /dev/null
+++ b/test_plans/vf_offload.rst
@@ -0,0 +1,178 @@
+Prerequisites
+=========================================
+
+
+Create Two VF interfaces from two kernel PF ineterfaces, and then attach them to VM.
+Start testpmd on vm::
+
+
+ ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x7 -n 1 -- -i
+ --portmask=0x1 --enable-rx-cksum --txqflags=0
+ --crc-strip --port-topology=loop
+
+
+Test Case: Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit
+packet
+=======================================================================
+=
+
+Setup the ``csum`` forwarding mode::
+
+ testpmd> set fwd csum
+ Set csum packet forwarding mode
+
+Enable the IPv4/UDP/TCP/SCTP checksum offload on port 0::
+
+ testpmd> tx_checksum set 0xf 0
+ testpmd> start
+ csum packet forwarding - CRC stripping disabled - packets/burst=32
+ nb forwarding cores=1 - nb forwarding ports=10
+ RX queues=1 - RX desc=128 - RX free threshold=64
+ RX threshold registers: pthresh=8 hthresh=8 wthresh=4
+ TX queues=1 - TX desc=512 - TX free threshold=0
+ TX threshold registers: pthresh=32 hthresh=8 wthresh=8
+
+Configure the traffic generator to send the multiple packets for the
+following
+combination: IPv4/UDP, IPv4/TCP, IPv4/SCTP, IPv6/UDP, IPv6/TCP.
+
+Except that SCTP header + payload length must be a multiple of 4 bytes.
+IPv4 + UDP/TCP packet length can range from the minimum length to 1518 bytes.
+
+Then verify that the same number of packet are correctly received on
+the traffic generator side. And IPv4 checksum, TCP checksum, UDP
+checksum, SCTP CRC32c need be validated as pass by the IXIA.
+
+The IPv4 source address will not be changed by testpmd.
+
+
+Test Case: Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit
+packet
+=======================================================================
+===
+
+Setup the ``csum`` forwarding mode::
+
+ testpmd> set fwd csum
+ Set csum packet forwarding mode
+
+Disable the IPv4/UDP/TCP/SCTP checksum offload on port 0::
+
+ testpmd> tx_checksum set 0x0 0
+ testpmd> start
+ csum packet forwarding - CRC stripping disabled - packets/burst=32
+ nb forwarding cores=1 - nb forwarding ports=10
+ RX queues=1 - RX desc=128 - RX free threshold=64
+ RX threshold registers: pthresh=8 hthresh=8 wthresh=4
+ TX queues=1 - TX desc=512 - TX free threshold=0
+ TX threshold registers: pthresh=32 hthresh=8 wthresh=8
+
+Configure the traffic generator to send the multiple packets for the
+follwing
+combination: IPv4/UDP, IPv4/TCP, IPv6/UDP, IPv6/TCP.
+
+IPv4 + UDP/TCP packet length can range from the minimum length to 1518 bytes.
+
+Then verify that the same number of packet are correctly received on
+the traffic generator side. And IPv4 checksum, TCP checksum, UDP
+checksum need be validated as pass by the IXIA.
+
+The first byte of source IPv4 address will be increment by testpmd. The
+checksum is indeed recalculated by software algorithms.
+
+
+
+
+If you start vm by manual ,you can refer to below commands Suppose PF
+is 0000:04:00.0. Generate 2VFs using commands below and make them in pci-stub mods.
+
+1. Get the pci device id of DUT::
+
+ ./dpdk_nic_bind.py --st
+ 0000:04:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection'
+ if=ens261f0 drv=ixgbe unused=igb_uio
+
+2. Create 2 VFs from 2 PFs::
+
+ echo 2 > /sys/bus/pci/devices/0000\:04\:00.0/sriov_numvfs
+
+VFs 04:10.0 & 04:10.1 have been created::
+
+ ./dpdk_nic_bind.py --st
+ 0000:04:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' if=ens261f0 drv=ixgbe unused=
+ 0000:04:10.0 '82599 Ethernet Controller Virtual Function' if=enp4s16 drv=ixgbevf unused=
+ 0000:04:10.1 '82599 Ethernet Controller Virtual Function'
+ if=enp4s16f1 drv=ixgbevf unused=
+
+3. detach VFs from the host, bind them to pci-stub driver::
+
+ /sbin/modprobe pci-stub
+ echo "8086 10ed" > /sys/bus/pci/drivers/pci-stub/new_id
+ echo 0000:04:10.0 > /sys/bus/pci/devices/0000\:04\:10.0/driver/unbind
+ echo 0000:04:10.0 > /sys/bus/pci/drivers/pci-stub/bind
+ echo 0000:04:10.1 > /sys/bus/pci/devices/0000\:04\:10.1/driver/unbind
+ echo 0000:04:10.1 > /sys/bus/pci/drivers/pci-stub/bind
+
+or using the following more easy way::
+
+ ./dpdk_nic_bind.py -b pci-stub 04:10.0 04:10.1
+
+it can be seen that VFs 04:10.0 & 04:10.1 's drv is pci-stub::
+
+ ./dpdk_nic_bind.py --st
+ 0000:04:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' if=ens261f0 drv=ixgbe unused=vfio-pci
+ 0000:04:10.0 '82599 Ethernet Controller Virtual Function' if= drv=pci-stub unused=ixgbevf,vfio-pci
+ 0000:04:10.1 '82599 Ethernet Controller Virtual Function' if=
+ drv=pci-stub unused=ixgbevf,vfio-pci
+
+4. Do not forget bring up PFs::
+
+ ifconfig ens261f0 up
+
+Passthrough VFs 04:10.0 & 04:10.1 to vm0, and start vm0, you can refer to below command::
+
+ taskset -c 6-12 qemu-system-x86_64 \
+ -enable-kvm -m 8192 -smp 6 -cpu host -name dpdk15-vm1 \
+ -drive file=/home/image/fedora23.img \
+ -netdev tap,id=hostnet1,ifname=tap1,script=/etc/qemu-ifup,vhost=on \
+ -device rtl8139,netdev=hostnet1,id=net1,mac=52:54:01:6b:10:61,bus=pci.0,addr=0xa \
+ -device pci-assign,bus=pci.0,addr=0x6,host=04:10.0 \
+ -device pci-assign,bus=pci.0,addr=0x7,host=04:10.1 \
+ -vnc :11 -daemonize
+
+the /etc/qemu-ifup can be below script, need you to create first::
+
+ #!/bin/sh
+ set -x
+ switch=br0
+ if [ -n "$1" ];then
+ /usr/sbin/tunctl -u `whoami` -t $1
+ /sbin/ip link set $1 up
+ sleep 0.5s
+ /usr/sbin/brctl addif $switch $1
+ exit 0
+ else
+ echo "Error: no interface specified"
+ exit 1
+ fi
+
+Set up bridge br0 before create /etc/qemu-ifup, for example::
+
+ cd /etc/sysconfig/network-scripts
+ vim ifcfg-enp1s0f0
+
+ HWADDR=00:1e:67:fb:0f:d4
+ TYPE=Ethernet
+ NAME=enp1s0f0
+ ONBOOT=yes
+ DEVICE=enp1s0f0
+ NM_CONTROLLED=no
+ BRIDGE=br0
+
+ vim ifcfg-br0
+ TYPE=Bridge
+ DEVICE=br0
+ ONBOOT=yes
+ NM_CONTROLLED=no
+ BOOTPROTO=dhcp
+ HOSTNAME="dpdk-test58"
+
+Login vm0, got VFs pci device id in vm0, assume they are 00:06.0 &
+00:07.0, bind them to igb_uio driver, and then start testpmd, set it in
+mac forward mode::
+
+ ./tools/dpdk_nic_bind.py --bind=igb_uio 00:06.0 00:07.0
+ ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f -n 4 -- -i
+ testpmd-> set fwd mac
+ testpmd-> start
diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py new file mode 100644 index 0000000..ccae3c6
--- /dev/null
+++ b/tests/TestSuite_vf_offload.py
@@ -0,0 +1,369 @@
+# <COPYRIGHT_TAG>
+
+import re
+import time
+
+import dts
+from qemu_kvm import QEMUKvm
+from test_case import TestCase
+from pmd_output import PmdOutput
+from utils import RED, GREEN
+from net_device import NetDevice
+from crb import Crb
+from scapy.all import *
+from settings import HEADER_SIZE
+VM_CORES_MASK = 'all'
+
+class TestVfOffload(TestCase):
+
+ def set_up_all(self):
+ self.dut_ports = self.dut.get_ports(self.nic)
+ self.verify(len(self.dut_ports) > 1, "Insufficient ports")
+ self.vm0 = None
+ self.setup_2pf_2vf_1vm_env_flag = 0
+ self.setup_2pf_2vf_1vm_env(driver='')
+ self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
+ self.portMask = dts.create_mask([self.vm0_dut_ports[0]])
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+
+ def set_up(self):
+ pass
+
+ def setup_2pf_2vf_1vm_env(self, driver='default'):
+
+ self.used_dut_port_0 = self.dut_ports[0]
+ self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1, driver=driver)
+ self.sriov_vfs_port_0 = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
+ self.used_dut_port_1 = self.dut_ports[1]
+ self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, driver=driver)
+ self.sriov_vfs_port_1 =
+ self.dut.ports_info[self.used_dut_port_1]['vfs_port']
+
+ try:
+
+ for port in self.sriov_vfs_port_0:
+ port.bind_driver('pci-stub')
+
+ for port in self.sriov_vfs_port_1:
+ port.bind_driver('pci-stub')
+
+ time.sleep(1)
+ vf0_prop = {'opt_host': self.sriov_vfs_port_0[0].pci}
+ vf1_prop = {'opt_host': self.sriov_vfs_port_1[0].pci}
+
+ if driver == 'igb_uio':
+ # start testpmd without the two VFs on the host
+ self.host_testpmd = PmdOutput(self.dut)
+ eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov_vfs_port_0[0].pci,
+ 'vf1': self.sriov_vfs_port_1[0].pci}
+ self.host_testpmd.start_testpmd("1S/2C/2T",
+ eal_param=eal_param)
+
+ # set up VM0 ENV
+ self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_port_start_stop')
+ self.vm0.set_vm_device(driver='pci-assign', **vf0_prop)
+ self.vm0.set_vm_device(driver='pci-assign', **vf1_prop)
+ self.vm_dut_0 = self.vm0.start()
+ if self.vm_dut_0 is None:
+ raise Exception("Set up VM0 ENV failed!")
+
+ self.setup_2pf_2vf_1vm_env_flag = 1
+ except Exception as e:
+ self.destroy_2pf_2vf_1vm_env()
+ raise Exception(e)
+
+ def destroy_2pf_2vf_1vm_env(self):
+ if getattr(self, 'vm0', None):
+ #destroy testpmd in vm0
+ self.vm0_testpmd.execute_cmd('stop')
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ self.vm0_testpmd = None
+ self.vm0_dut_ports = None
+ #destroy vm0
+ self.vm0.stop()
+ self.vm0 = None
+
+ if getattr(self, 'host_testpmd', None):
+ self.host_testpmd.execute_cmd('quit', '# ')
+ self.host_testpmd = None
+
+ if getattr(self, 'used_dut_port_0', None):
+ self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0)
+ port = self.dut.ports_info[self.used_dut_port_0]['port']
+ port.bind_driver()
+ self.used_dut_port_0 = None
+
+ if getattr(self, 'used_dut_port_1', None):
+ self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1)
+ port = self.dut.ports_info[self.used_dut_port_1]['port']
+ port.bind_driver()
+ self.used_dut_port_1 = None
+
+ for port_id in self.dut_ports:
+ port = self.dut.ports_info[port_id]['port']
+ port.bind_driver()
+
+ self.setup_2pf_2vf_1vm_env_flag = 0
+
+ def checksum_enablehw(self, port, dut):
+ dut.send_expect("csum set ip hw %d" % port, "testpmd>")
+ dut.send_expect("csum set udp hw %d" % port, "testpmd>")
+ dut.send_expect("csum set tcp hw %d" % port, "testpmd>")
+ dut.send_expect("csum set sctp hw %d" % port, "testpmd>")
+
+ def checksum_enablesw(self, port, dut):
+ dut.send_expect("csum set ip sw %d" % port, "testpmd>")
+ dut.send_expect("csum set udp sw %d" % port, "testpmd>")
+ dut.send_expect("csum set tcp sw %d" % port, "testpmd>")
+ dut.send_expect("csum set sctp sw %d" % port, "testpmd>")
+
+ def checksum_validate(self, packets_sent, packets_expected):
+ """
+ Validate the checksum.
+ """
+ tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
+ rx_interface =
+ self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]
+ ))
+
+ sniff_src = self.vm0_testpmd.get_port_mac(0)
+ checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)")
+
+ chksum = dict()
+ result = dict()
+
+ self.tester.send_expect("scapy", ">>> ")
+
+ for packet_type in packets_expected.keys():
+ self.tester.send_expect("p = %s" % packets_expected[packet_type], ">>>")
+ out = self.tester.send_expect("p.show2()", ">>>")
+ chksums = checksum_pattern.findall(out)
+ chksum[packet_type] = chksums
+ print packet_type, ": ", chksums
+
+ self.tester.send_expect("exit()", "#")
+
+ self.tester.scapy_background()
+ self.tester.scapy_append('p = sniff(filter="ether src %s", iface="%s", count=%d)' % (sniff_src, rx_interface, len(packets_sent)))
+ self.tester.scapy_append('nr_packets=len(p)')
+ self.tester.scapy_append('reslist = [p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") for i in range(nr_packets)]')
+ self.tester.scapy_append('import string')
+ self.tester.scapy_append('RESULT = string.join(reslist, ",")')
+
+ # Send packet.
+ self.tester.scapy_foreground()
+
+ for packet_type in packets_sent.keys():
+ self.tester.scapy_append('sendp([%s], iface="%s")' %
+ (packets_sent[packet_type], tx_interface))
+
+ self.tester.scapy_execute()
+ out = self.tester.scapy_get_result()
+ packets_received = out.split(',')
+ self.verify(len(packets_sent) == len(packets_received),
+ "Unexpected Packets Drop")
+
+ for packet_received in packets_received:
+ ip_checksum, tcp_checksum, udp_checksup, sctp_checksum = packet_received.split(';')
+ print "ip_checksum: ", ip_checksum, "tcp_checksum:, ",
+ tcp_checksum, "udp_checksup: ", udp_checksup, "sctp_checksum: ",
+ sctp_checksum
+
+ packet_type = ''
+ l4_checksum = ''
+ if tcp_checksum != '??':
+ packet_type = 'TCP'
+ l4_checksum = tcp_checksum
+ elif udp_checksup != '??':
+ packet_type = 'UDP'
+ l4_checksum = udp_checksup
+ elif sctp_checksum != '??':
+ packet_type = 'SCTP'
+ l4_checksum = sctp_checksum
+
+ if ip_checksum != '??':
+ packet_type = 'IP/' + packet_type
+ if chksum[packet_type] != [ip_checksum, l4_checksum]:
+ result[packet_type] = packet_type + " checksum error"
+ else:
+ packet_type = 'IPv6/' + packet_type
+ if chksum[packet_type] != [l4_checksum]:
+ result[packet_type] = packet_type + " checksum error"
+
+ return result
+
+ def test_checksum_offload_enable(self):
+ """
+ Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit packet.
+ Enable Checksum offload.
+ Verify that the same number of packet are correctly received on the
+ traffic generator side.
+ """
+ self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "--portmask=%s " %
+ (self.portMask) + "--disable-hw-vlan --enable-rx-cksum " + "--txqflags=0 " +
+ "--crc-strip --port-topology=loop")
+ self.vm0_testpmd.execute_cmd('set fwd csum')
+
+ time.sleep(2)
+
+ mac = self.vm0_testpmd.get_port_mac(0)
+
+ pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % mac,
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % mac,
+ 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % mac,
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % mac,
+ 'IPv6/TCP': 'Ether(dst="%s",
+ src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' %
+ mac}
+
+ pkts_ref = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/UDP()/("X"*46)' % mac,
+ 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/TCP()/("X"*46)' % mac,
+ 'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % mac,
+ 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::2")/UDP()/("X"*46)' % mac,
+ 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00",
+ src="%s")/IPv6(src="::2")/TCP()/("X"*46)' % mac}
+
+ if self.nic in ['redrockcanyou', 'atwood']:
+ del pkts['IP/SCTP']
+ del pkts_ref['IP/SCTP']
+
+ self.checksum_enablehw(0,self.vm_dut_0)
+
+ self.vm0_testpmd.execute_cmd('start')
+ result = self.checksum_validate(pkts, pkts_ref)
+ self.vm0_testpmd.execute_cmd('stop')
+
+ self.verify(len(result) == 0, string.join(result.values(),
+ ","))
+
+ def _test_checksum_offload_disable(self):
+ """
+ Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit packet.
+ Disable Checksum offload.
+ Verify that the same number of packet are correctly received on
+ the traffic generator side.
+ """
+
+ self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "--portmask=%s " %
+ (self.portMask) + "--disable-hw-vlan --enable-rx-cksum " +
+ "--crc-strip --port-topology=loop")
+ self.vm0_testpmd.execute_cmd('set fwd csum')
+
+ time.sleep(2)
+
+
+ mac = self.vm0_testpmd.get_port_mac(0)
+ sndIP = '10.0.0.1'
+ sndIPv6 = '::1'
+ sndPkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % (mac, sndIP),
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % (mac, sndIP),
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' % (mac, sndIPv6),
+ 'IPv6/TCP': 'Ether(dst="%s",
+ src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' %
+ (mac, sndIPv6)}
+
+ expIP = "10.0.0.2"
+ expIPv6 = '::2'
+ expPkts = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)' % (mac, expIP),
+ 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)' % (mac, expIP),
+ 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)' % (mac, expIPv6),
+ 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00",
+ src="%s")/IPv6(src="%s")/TCP()/("X"*46)' % (mac, expIPv6)}
+
+ self.vm0_testpmd.execute_cmd('start')
+ result = self.checksum_validate(sndPkts, expPkts)
+ self.vm0_testpmd.execute_cmd('stop')
+
+ self.verify(len(result) == 0, string.join(result.values(),
+ ","))
+
+ def tcpdump_start_sniffing(self, ifaces=[]):
+ """
+ Starts tcpdump in the background to sniff the tester interface where
+ the packets are transmitted to and from the self.dut.
+ All the captured packets are going to be stored in a file for a
+ post-analysis.
+ """
+
+ for iface in ifaces:
+ command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
+ self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface)
+ self.tester.send_expect(command, '#')
+
+ def tcpdump_stop_sniff(self):
+ """
+ Stops the tcpdump process running in the background.
+ """
+ self.tester.send_expect('killall tcpdump', '#')
+ time.sleep(1)
+ self.tester.send_expect('echo "Cleaning buffer"', '#')
+ time.sleep(1)
+
+ def tcpdump_command(self, command):
+ """
+ Sends a tcpdump related command and returns an integer from the output
+ """
+
+ result = self.tester.send_expect(command, '#')
+ print result
+ return int(result.strip())
+
+ def number_of_packets(self, iface):
+ """
+ By reading the file generated by tcpdump it counts how many packets were
+ forwarded by the sample app and received in the self.tester. The sample app
+ will add a known MAC address for the test to look for.
+ """
+
+ command = ('tcpdump -A -nn -e -v -r tcpdump_{iface}.pcap 2>/dev/null | ' +
+ 'grep -c "seq"')
+ return self.tcpdump_command(command.format(**locals()))
+
+ def test_tso(self):
+ """
+ TSO IPv4 TCP, IPv6 TCP, VXLan testing
+ """
+ import pdb
+ pdb.set_trace()
+ tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
+ rx_interface =
+ self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1]
+ ))
+
+ self.frame_sizes = [128, 1458]
+ self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + HEADER_SIZE['tcp']
+ padding = self.frame_sizes[0] - self.headers_size
+
+ self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
+ self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
+
+ self.portMask = dts.create_mask([self.vm0_dut_ports[0]])
+ self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "--portmask=%s " %
+ (self.portMask) + "--enable-rx-cksum " +
+ "--txqflags=0 " +
+ "--crc-strip
+ --port-topology=loop")
+
+ mac = self.vm0_testpmd.get_port_mac(0)
+
+ self.checksum_enablehw(0,self.vm_dut_0)
+ self.vm0_testpmd.execute_cmd("tso set 800 %d" % self.vm0_dut_ports[1])
+ self.vm0_testpmd.execute_cmd("set fwd csum")
+ self.vm0_testpmd.execute_cmd("start")
+
+ self.tester.scapy_foreground()
+ time.sleep(5)
+
+ # IPv4 tcp test
+
+ self.tcpdump_start_sniffing([tx_interface, rx_interface])
+ self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
+ out = self.tester.scapy_execute()
+ out = self.vm0_testpmd.execute_cmd("show port stats all")
+ print out
+ self.tcpdump_stop_sniff()
+ rx_stats = self.number_of_packets(rx_interface)
+ if (rx_stats == 2):
+ self.verify(1, "Pass")
+
+ # IPv6 tcp test
+
+ self.tcpdump_start_sniffing([tx_interface, rx_interface])
+ self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
+ out = self.tester.scapy_execute()
+ out = self.vm0_testpmd.execute_cmd("show port stats all")
+ print out
+ self.tcpdump_stop_sniff()
+ rx_stats = self.number_of_packets(rx_interface)
+ if (rx_stats == 2):
+ self.verify(1, "Pass")
+
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ print "tear_down_all"
+ if self.setup_2pf_2vf_1vm_env_flag == 1:
+ self.destroy_2pf_2vf_1vm_env()
--
2.5.0
prev parent reply other threads:[~2016-02-22 5:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 5:36 Lijuan Tu
2016-02-22 5:52 ` Pei, Yulong [this message]
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=188971FCDA171749BED5DA74ABF3E6F0035301FC@shsmsx102.ccr.corp.intel.com \
--to=yulong.pei@intel.com \
--cc=dts@dpdk.org \
--cc=lijuanx.a.tu@intel.com \
--cc=qian.q.xu@intel.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).