test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1 1/2] test_plans/mac_filter: add the vlan filter check after setting multicast filter
@ 2023-01-12  9:15 Weiyuan Li
  2023-01-12  9:15 ` [dts][PATCH V1 2/2] tests/mac_filter: " Weiyuan Li
  0 siblings, 1 reply; 3+ messages in thread
From: Weiyuan Li @ 2023-01-12  9:15 UTC (permalink / raw)
  To: dts; +Cc: Weiyuan Li

Add the vlan filter check after setting multicast filter.

1. Enable vlan filter and add vlan id. Send a packet with multicast dst
mac and vlan tag can receive packet.
2. Disable vlan filter and remove vlan id. Send a packet with multicast
dst mac can receive packet.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 test_plans/mac_filter_test_plan.rst | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/test_plans/mac_filter_test_plan.rst b/test_plans/mac_filter_test_plan.rst
index 09335930..58acda39 100644
--- a/test_plans/mac_filter_test_plan.rst
+++ b/test_plans/mac_filter_test_plan.rst
@@ -162,6 +162,37 @@ Send a packet with multicast destination MAC address to port 0::
      src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 - length=60 - nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - Receive queue=0x0
      ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
 
+Enable vlan filter and add vlan id::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 4012 0
+
+Send a packet with multicast destination MAC address and vlan tag to port 0::
+
+  sendp([Ether(dst='01:00:5E:00:00:00', src='00:00:20:00:00:00')/Dot1Q(vlan=2960, prio=0)/IP()/UDP()/Raw(load=b'XXXXXXXXXXXXXX')],iface="ens256f0",count=1,inter=0,verbose=False)
+
+Check can receive the packet::
+
+  port 0/queue 0: received 1 packets
+    src=00:00:20:00:00:00 - dst=01:00:5E:00:00:00 - pool=mb_pool_0 - type=0x8100 - length=60 - nb_segs=1 - VLAN tci=0x0 - hw ptype: L2_ETHER L3_IPV4 L4_UDP  - sw ptype: L2_ETHER_VLAN L3_IPV4 L4_UDP  - l2_len=18 - l3_len=20 - l4_len=8 - Receive queue=0x0
+    ol_flags: RTE_MBUF_F_RX_VLAN RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN
+
+Send a packet with multicast destination MAC address and wrong vlan tag to port 0::
+
+  sendp([Ether(dst='01:00:5E:00:00:00', src='00:00:20:00:00:00')/Dot1Q(vlan=2959, prio=0)/IP()/UDP()/Raw(load=b'XXXXXXXXXXXXXX')],iface="ens256f0",count=4,inter=0,verbose=False)
+
+Check can't receive the packet.
+
+Disable vlan filter and remove vlan id::
+
+    testpmd> rx_vlan remove 4012 0
+    testpmd> vlan set filter off 0
+
+Send a packet with multicast destination MAC address to port 0::
+
+   port 0/queue 0: received 1 packets
+     src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 - length=60 - nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - Receive queue=0x0
+     ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
 
 Remove the multicast MAC address from the multicast filter::
 
-- 
2.27.0


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

* [dts][PATCH V1 2/2] tests/mac_filter: add the vlan filter check after setting multicast filter
  2023-01-12  9:15 [dts][PATCH V1 1/2] test_plans/mac_filter: add the vlan filter check after setting multicast filter Weiyuan Li
@ 2023-01-12  9:15 ` Weiyuan Li
  2023-01-13  2:46   ` lijuan.tu
  0 siblings, 1 reply; 3+ messages in thread
From: Weiyuan Li @ 2023-01-12  9:15 UTC (permalink / raw)
  To: dts; +Cc: Weiyuan Li

Add the vlan filter check after setting multicast filter.

1. Enable vlan filter and add vlan id. Send a packet with multicast dst
mac and vlan tag can receive packet.
2. Disable vlan filter and remove vlan id. Send a packet with multicast
dst mac can receive packet.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_mac_filter.py | 45 +++++++++++++++++++++++++++++++----
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index a0ba65c7..afd99080 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -8,6 +8,7 @@ Test the support of Allowlist Features by Poll Mode Drivers
 """
 
 import operator
+import random
 import time
 
 import framework.utils as utils
@@ -15,6 +16,8 @@ from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
 
+MAX_VLAN = 4095
+
 
 class TestMacFilter(TestCase):
     def set_up_all(self):
@@ -56,7 +59,9 @@ class TestMacFilter(TestCase):
             out, "Maximum number of MAC addresses: ([0-9]+)"
         )
 
-    def allowlist_send_packet(self, portid, destMac="00:11:22:33:44:55", count=-1):
+    def allowlist_send_packet(
+        self, portid, destMac="00:11:22:33:44:55", count=-1, pkt_type="UDP", vlan=""
+    ):
         """
         Send 1 packet to portid.
         """
@@ -65,8 +70,13 @@ class TestMacFilter(TestCase):
             count = self.frames_to_send
 
         itf = self.tester.get_interface(self.tester.get_local_port(portid))
-        pkt = Packet(pkt_type="UDP")
-        pkt.config_layer("ether", {"src": "52:00:00:00:00:00", "dst": destMac})
+        if pkt_type == "VLAN_UDP" and vlan is not None:
+            pkt = Packet(pkt_type="VLAN_UDP")
+            pkt.config_layer("vlan", {"vlan": vlan})
+            pkt.config_layer("ether", {"dst": destMac})
+        else:
+            pkt = Packet(pkt_type="UDP")
+            pkt.config_layer("ether", {"src": "52:00:00:00:00:00", "dst": destMac})
         pkt.send_pkt(self.tester, tx_port=itf, count=count)
 
     def test_add_remove_mac_address(self):
@@ -188,6 +198,7 @@ class TestMacFilter(TestCase):
         Remove mac address and check packet can't received
         """
         # initialise first port without promiscuous mode
+        random_vlan = random.randint(1, MAX_VLAN)
         mcast_addr = "01:00:5E:00:00:00"
         portid = self.dutPorts[0]
         self.dut.send_expect(f"set promisc {portid:d} off", "testpmd> ")
@@ -201,7 +212,33 @@ class TestMacFilter(TestCase):
             "received" in out,
             "Packet has not been received when it should have on a broadcast address",
         )
-
+        # enable vlan filter
+        self.dut.send_expect("vlan set filter on 0", "testpmd> ")
+        self.dut.send_expect("rx_vlan add %d 0" % random_vlan, "testpmd> ")
+        # passed vlan id
+        self.allowlist_send_packet(
+            portid, destMac=mcast_addr, pkt_type="VLAN_UDP", vlan=random_vlan
+        )
+        out = self.dut.get_session_output()
+        self.verify("received" in out, "Not receive vlan packet with multicast mac!!!")
+        # wrong vlan id
+        self.allowlist_send_packet(
+            portid, destMac=mcast_addr, pkt_type="VLAN_UDP", vlan=random_vlan - 1
+        )
+        out = self.dut.get_session_output()
+        self.verify(
+            "received" not in out,
+            "Wrong vlan packet can't receive with multicast mac!!!",
+        )
+        # disbale vlan filter and remove vlan id
+        self.dut.send_expect("rx_vlan rm %d 0" % random_vlan, "testpmd> ")
+        self.dut.send_expect("vlan set filter off 0", "testpmd> ")
+        self.allowlist_send_packet(portid, mcast_addr, count=1)
+        out = self.dut.get_session_output()
+        self.verify(
+            "received" in out,
+            "Packet has not been received when it should have on a broadcast address",
+        )
         self.dut.send_expect(f"mcast_addr remove {portid:d} {mcast_addr}", "testpmd>")
         self.allowlist_send_packet(portid, mcast_addr, count=1)
         time.sleep(1)
-- 
2.27.0


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

* [dts][PATCH V1 2/2] tests/mac_filter: add the vlan filter check after setting multicast filter
  2023-01-12  9:15 ` [dts][PATCH V1 2/2] tests/mac_filter: " Weiyuan Li
@ 2023-01-13  2:46   ` lijuan.tu
  0 siblings, 0 replies; 3+ messages in thread
From: lijuan.tu @ 2023-01-13  2:46 UTC (permalink / raw)
  To: dts, Weiyuan Li; +Cc: Weiyuan Li

On Thu, 12 Jan 2023 17:15:19 +0800, Weiyuan Li <weiyuanx.li@intel.com> wrote:
> Add the vlan filter check after setting multicast filter.
> 
> 1. Enable vlan filter and add vlan id. Send a packet with multicast dst
> mac and vlan tag can receive packet.
> 2. Disable vlan filter and remove vlan id. Send a packet with multicast
> dst mac can receive packet.
> 
> Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>

Acked-by: Lijuan Tu <lijuan.tu@intel.com>
Series applied, thanks

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

end of thread, other threads:[~2023-01-13  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12  9:15 [dts][PATCH V1 1/2] test_plans/mac_filter: add the vlan filter check after setting multicast filter Weiyuan Li
2023-01-12  9:15 ` [dts][PATCH V1 2/2] tests/mac_filter: " Weiyuan Li
2023-01-13  2:46   ` lijuan.tu

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