test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PTCH V1 1/2] add link status interrupt test plan
@ 2016-04-27 12:18 xu,gang
  2016-04-27 12:18 ` [dts] [PTCH V1 2/2] add link status interrupt test script xu,gang
  2016-04-29 18:02 ` [dts] [PTCH V1 1/2] add link status interrupt test plan Liu, Yong
  0 siblings, 2 replies; 3+ messages in thread
From: xu,gang @ 2016-04-27 12:18 UTC (permalink / raw)
  To: dts; +Cc: xu,gang

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 test_plans/link_status_interrupt_test_plan.rst | 65 ++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 test_plans/link_status_interrupt_test_plan.rst

diff --git a/test_plans/link_status_interrupt_test_plan.rst b/test_plans/link_status_interrupt_test_plan.rst
new file mode 100644
index 0000000..60d9716
--- /dev/null
+++ b/test_plans/link_status_interrupt_test_plan.rst
@@ -0,0 +1,65 @@
+.. <COPYRIGHT_TAG>
+
+==================
+Link Status Detect
+==================
+
+This tests for Detect Link Status feature can be run on linux userspace.
+It is to check if the userspace interrupt can be received after plugging
+in/out the cable/fiber on specified NIC port, and if the link status can
+be updated correctly. Futhermore, it would be better to check if packets
+can be received and sent on a specified port after its link has just up.
+So it may need layer 2 forwarding at the same time.
+
+For layer 2 forwarding, a packet received on a RX port (RX_PORT), it would
+be transmitted from a TX port (TX_PORT=RX_PORT+1) if RX_PORT is even;
+otherwise from a TX port (TX_PORT=RX_PORT-1) if RX_PORT is odd. Before
+being transmitted, the source mac address of the packet would be replaced
+by the mac address of the TX port, while the destination mac address would
+be replaced by 00:09:c0:00:00:TX_PORT_ID. The test application should be
+run with the wanted paired ports configured using the coremask parameter
+via the command line. i.e. port 0 and 1 is a valid pair, while port 1 and
+2 isn't. The test is performed by running the test application and using a
+traffic generator.
+
+The ``link_status_interrupt`` application is run with EAL parameters and 
+parameters for the application itself. This application supports three
+parameters for itself.
+
+	- ``-p PORTMASK``: hexadecimal bitmask of ports to config
+	- ``-q NQ``: number of queue per lcore (default is 1)
+	- ``-T PERIOD``: refresh periond in seconds (0/10/86400: disable/default/maximum)
+
+Prerequisites
+=============
+
+Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
+When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
+"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
+The test app need add a cmdline, "--vfio-intr=int_x"
+
+Assume port 0 and 1 are connected to the remote ports, e.g. packet generator.
+To run the test application in linuxapp environment with 4 lcores, 2 ports and
+2 RX queues per lcore::
+
+	$ ./link_status_interrupt -c f -- -q 2 -p 0x3
+
+Also, if the ports need to be tested are different, the port mask should be
+changed. The lcore used to run the test application and the number of queues
+per lcore could be changed.
+
+Test Case: Link Status Change
+=============================
+
+Run the test application as above command. Then plug out the cable/fiber, or
+simulate a disconnection. After several seconds, check if the link is actully
+off. Then plug in the cable/fiber, or simulate a connection. After several seconds,
+check if the link is actually up, and print its information about duplex and speed.
+
+Test Case: Port available
+=========================
+
+Run the test application as above command with cable/fiber plugged out from both
+port 0 and 1, then plug it in. After several seconds and the link of all the ports
+is up. Together with packet generator, do layer 2 forwarding, and check if the
+packets can be received on port 0/1 and sent out on port 1/0.
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts] [PTCH V1 2/2] add link status interrupt test script
  2016-04-27 12:18 [dts] [PTCH V1 1/2] add link status interrupt test plan xu,gang
@ 2016-04-27 12:18 ` xu,gang
  2016-04-29 18:02 ` [dts] [PTCH V1 1/2] add link status interrupt test plan Liu, Yong
  1 sibling, 0 replies; 3+ messages in thread
From: xu,gang @ 2016-04-27 12:18 UTC (permalink / raw)
  To: dts; +Cc: xu,gang

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 tests/TestSuite_link_status_interrupt.py | 205 +++++++++++++++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 tests/TestSuite_link_status_interrupt.py

diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py
new file mode 100644
index 0000000..2a02fc9
--- /dev/null
+++ b/tests/TestSuite_link_status_interrupt.py
@@ -0,0 +1,205 @@
+# <COPYRIGHT_TAG>
+
+"""
+DPDK Test suite.
+
+Link Status Detection
+
+"""
+
+# NOTE: These tests generally won't work in automated mode since the
+# link doesn't stay down unless the cable is actually removed. The code
+# is left here for legacy reasons.
+
+
+import dts
+import re
+
+testPorts = []
+intr_mode = ['"intr_mode=random"',
+             '"intr_mode=msix"', '"intr_mode=legacy"', '']
+intr_mode_output = ['Error: bad parameter - random', 'Use MSIX interrupt',
+                    'Use legacy interrupt', 'Use MSIX interrupt by default']
+
+
+from test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestLinkStatusInterrupt(TestCase):
+
+    #
+    #
+    #
+    # Test cases.
+    #
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+
+
+        Link Status Interrupt Prerequisites
+        """
+
+        dutPorts = self.dut.get_ports(self.nic)
+        self.verify(len(dutPorts) > 1, "Insufficient ports for " + self.nic)
+        for n in range(2):
+            testPorts.append(dutPorts[n])
+            inter = self.tester.get_interface(
+                self.tester.get_local_port(testPorts[n]))
+            self.tester.send_expect("ifconfig %s up" % inter, "# ", 5)
+        out = self.dut.send_expect(
+            "make -C examples/link_status_interrupt", "# ")
+        self.verify("Error" not in out, "Compilation error 1")
+        self.verify("No such file" not in out, "Compilation error 2")
+
+    def set_link_status_and_verify(self, dutPort, status):
+        """
+        In registered callback...
+        Event type: LSC interrupt
+        Port 0 Link Up - speed 10000 Mbps - full-duplex
+
+        In registered callback...
+        Event type: LSC interrupt
+        Port 0 Link Down
+        """
+
+        inter = self.tester.get_interface(self.tester.get_local_port(dutPort))
+        self.tester.send_expect("ifconfig %s %s" % (inter, status), "# ", 10)
+        self.dut.send_expect("", "Port %s Link %s" %
+                             (dutPort, status.capitalize()), 60)
+        out = self.dut.send_expect("", "Aggregate statistics", 60)
+        exp = r"Statistics for port (\d+) -+\r\n" + \
+            "Link status:\s+Link (up|down)\r\n"
+        pattern = re.compile(exp)
+        info = pattern.findall(out)
+        if info[0][0] == repr(dutPort):
+            self.verify(info[0][1] == status, "Link status change port error")
+        else:
+            self.verify(info[1][1] == status, "Link status change hello error")
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        pass
+
+    def test_link_status_interrupt_change(self):
+        """
+        Link status change.
+        """
+
+        memChannel = self.dut.get_memory_channels()
+        portMask = dts.create_mask(testPorts)
+        if dts.drivername in ["igb_uio"]:
+            cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % (
+                memChannel, portMask)
+        elif dts.drivername in ["vfio-pci"]:
+            cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx  -- -q 2 -p %s" % (
+                memChannel, portMask)
+        else:
+            print "unknow driver"
+        for n in range(len(intr_mode)):
+            if dts.drivername in ["igb_uio"]:
+                self.dut.send_expect("rmmod igb_uio", "# ")
+                self.dut.send_expect(
+                    "insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ")
+                self.dut.send_expect("tools/dpdk_nic_bind.py --bind=igb_uio 03:00.0 03:00.1", "# ") 
+                out = self.dut.send_expect(
+                    "dmesg -c | grep '\<%s\>'" % (intr_mode_output[n]), "# ")
+                self.verify(
+                    intr_mode_output[n] in out, "Fail to insmod igb_uio " + intr_mode[n])
+                if n == 0:
+                    continue
+            self.dut.send_expect(cmdline, "Aggregate statistics", 605)
+            self.dut.send_expect(
+                "", "Port %s Link Up.+\r\n" % (testPorts[1]), 5)
+            self.set_link_status_and_verify(testPorts[0], 'down')
+            self.set_link_status_and_verify(testPorts[0], 'up')
+            self.set_link_status_and_verify(testPorts[1], 'down')
+            self.set_link_status_and_verify(testPorts[1], 'up')
+            self.dut.send_expect("^C", "# ")
+
+    def FAILING_test_link_status_interrupt_port_available(self):
+        """
+        Port available.
+        """
+
+        memChannel = self.dut.get_memory_channels()
+        portMask = dts.create_mask(testPorts)
+        if dts.drivername in ["igb_uio"]:
+            cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % (
+                memChannel, portMask)
+        elif dts.drivername in ["vfio-pci"]:
+            cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx -- -q 2 -p %s " % (
+                memChannel, portMask)
+        else:
+            print "unknow driver"
+        for n in range(1, len(intr_mode)):
+            if dts.drivername in ["igb_uio"]:
+                self.dut.send_expect("rmmod igb_uio", "# ")
+                self.dut.send_expect(
+                    "insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ")
+                out = self.dut.send_expect(
+                    "dmesg -c | grep '\<%s\>'" % (intr_mode_output[n]), "# ")
+                self.verify(
+                    intr_mode_output[n] in out, "Fail to insmod igb_uio " + intr_mode[n])
+            self.dut.send_expect(cmdline, "Aggregate statistics", 60)
+            self.dut.send_expect(
+                "", "Port %s Link Up.+\r\n" % (testPorts[1]), 5)
+            self.set_link_status_and_verify(testPorts[0], 'down')
+            self.set_link_status_and_verify(testPorts[1], 'down')
+            self.set_link_status_and_verify(testPorts[0], 'up')
+            self.set_link_status_and_verify(testPorts[1], 'up')
+            for m in [0, 1]:
+                txPort = self.tester.get_local_port(testPorts[m])
+                rxPort = self.tester.get_local_port(testPorts[1 - m])
+                txItf = self.tester.get_interface(txPort)
+                rxItf = self.tester.get_interface(rxPort)
+                self.tester.scapy_background()
+                self.tester.scapy_append(
+                    'p = sniff(iface="%s", count=1)' % rxItf)
+                self.tester.scapy_append('nr_packets=len(p)')
+                self.tester.scapy_append('RESULT = str(nr_packets)')
+                self.tester.scapy_foreground()
+                self.tester.scapy_append(
+                    'sendp([Ether()/IP()/UDP()/("X"*46)], iface="%s")' % txItf)
+                self.tester.scapy_execute()
+                nr_packets = self.tester.scapy_get_result()
+                self.verify(nr_packets == "1", "Fail to switch L2 frame")
+            self.dut.send_expect("^C", "# ")
+
+    def test_link_status_interrupt_recovery(self):
+        """
+        Recovery.
+        """
+        if dts.drivername in ["igb_uio"]:
+            self.dut.send_expect("^C", "# ")
+            self.dut.send_expect("rmmod igb_uio", "# ")
+            self.dut.send_expect(
+                "insmod %s/kmod/igb_uio.ko" % (self.target), "# ")
+            out = self.dut.send_expect(
+                "dmesg -c | grep '\<Use MSIX interrupt by default\>'", "# ")
+            self.verify(
+                'Use MSIX interrupt by default' in out, "Fail to recovery default igb_uio")
+        elif dts.drivername in ["vfio-pci"]:
+            self.verify(Ture, "not need run this case, when used vfio driver")
+        else:
+            print "unknow driver"
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        pass
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        pass
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PTCH V1 1/2] add link status interrupt test plan
  2016-04-27 12:18 [dts] [PTCH V1 1/2] add link status interrupt test plan xu,gang
  2016-04-27 12:18 ` [dts] [PTCH V1 2/2] add link status interrupt test script xu,gang
@ 2016-04-29 18:02 ` Liu, Yong
  1 sibling, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2016-04-29 18:02 UTC (permalink / raw)
  To: Xu, GangX, dts; +Cc: Xu, GangX

Thanks, applied.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang
> Sent: Wednesday, April 27, 2016 5:18 AM
> To: dts@dpdk.org
> Cc: Xu, GangX
> Subject: [dts] [PTCH V1 1/2] add link status interrupt test plan
> 
> Signed-off-by: xu,gang <gangx.xu@intel.com>
> ---
>  test_plans/link_status_interrupt_test_plan.rst | 65
> ++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100644 test_plans/link_status_interrupt_test_plan.rst
> 
> diff --git a/test_plans/link_status_interrupt_test_plan.rst
> b/test_plans/link_status_interrupt_test_plan.rst
> new file mode 100644
> index 0000000..60d9716
> --- /dev/null
> +++ b/test_plans/link_status_interrupt_test_plan.rst
> @@ -0,0 +1,65 @@
> +.. <COPYRIGHT_TAG>
> +
> +==================
> +Link Status Detect
> +==================
> +
> +This tests for Detect Link Status feature can be run on linux userspace.
> +It is to check if the userspace interrupt can be received after plugging
> +in/out the cable/fiber on specified NIC port, and if the link status can
> +be updated correctly. Futhermore, it would be better to check if packets
> +can be received and sent on a specified port after its link has just up.
> +So it may need layer 2 forwarding at the same time.
> +
> +For layer 2 forwarding, a packet received on a RX port (RX_PORT), it
> would
> +be transmitted from a TX port (TX_PORT=RX_PORT+1) if RX_PORT is even;
> +otherwise from a TX port (TX_PORT=RX_PORT-1) if RX_PORT is odd. Before
> +being transmitted, the source mac address of the packet would be replaced
> +by the mac address of the TX port, while the destination mac address
> would
> +be replaced by 00:09:c0:00:00:TX_PORT_ID. The test application should be
> +run with the wanted paired ports configured using the coremask parameter
> +via the command line. i.e. port 0 and 1 is a valid pair, while port 1 and
> +2 isn't. The test is performed by running the test application and using
> a
> +traffic generator.
> +
> +The ``link_status_interrupt`` application is run with EAL parameters and
> +parameters for the application itself. This application supports three
> +parameters for itself.
> +
> +	- ``-p PORTMASK``: hexadecimal bitmask of ports to config
> +	- ``-q NQ``: number of queue per lcore (default is 1)
> +	- ``-T PERIOD``: refresh periond in seconds (0/10/86400:
> disable/default/maximum)
> +
> +Prerequisites
> +=============
> +
> +Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and
> enable vt-d in bios.
> +When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod
> vfiod driver, then used
> +"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio
> driver to test driver.
> +The test app need add a cmdline, "--vfio-intr=int_x"
> +
> +Assume port 0 and 1 are connected to the remote ports, e.g. packet
> generator.
> +To run the test application in linuxapp environment with 4 lcores, 2
> ports and
> +2 RX queues per lcore::
> +
> +	$ ./link_status_interrupt -c f -- -q 2 -p 0x3
> +
> +Also, if the ports need to be tested are different, the port mask should
> be
> +changed. The lcore used to run the test application and the number of
> queues
> +per lcore could be changed.
> +
> +Test Case: Link Status Change
> +=============================
> +
> +Run the test application as above command. Then plug out the cable/fiber,
> or
> +simulate a disconnection. After several seconds, check if the link is
> actully
> +off. Then plug in the cable/fiber, or simulate a connection. After
> several seconds,
> +check if the link is actually up, and print its information about duplex
> and speed.
> +
> +Test Case: Port available
> +=========================
> +
> +Run the test application as above command with cable/fiber plugged out
> from both
> +port 0 and 1, then plug it in. After several seconds and the link of all
> the ports
> +is up. Together with packet generator, do layer 2 forwarding, and check
> if the
> +packets can be received on port 0/1 and sent out on port 1/0.
> --
> 1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-29 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 12:18 [dts] [PTCH V1 1/2] add link status interrupt test plan xu,gang
2016-04-27 12:18 ` [dts] [PTCH V1 2/2] add link status interrupt test script xu,gang
2016-04-29 18:02 ` [dts] [PTCH V1 1/2] add link status interrupt test plan Liu, Yong

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).