<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 24, 2025 at 2:16 PM Dean Marx <<a href="mailto:dmarx@iol.unh.edu" target="_blank">dmarx@iol.unh.edu</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ packets = [<br>
+ Ether(dst="00:11:22:33:44:55", src="66:77:88:99:aa:bb")<br>
+ / Dot1AD(vlan=100)<br>
+ / Dot1Q(vlan=200)<br>
+ / IP(dst="192.0.2.1", src="198.51.100.1")<br>
+ / UDP(dport=1234, sport=5678), </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ Ether(dst="00:11:22:33:44:55", src="66:77:88:99:aa:bb")<br>
+ / Dot1AD(vlan=101)<br>
+ / Dot1Q(vlan=200)<br>
+ / IP(dst="192.0.2.1", src="198.51.100.1")<br>
+ / UDP(dport=1234, sport=5678),<br>
+ ]<br></blockquote><div><br></div><div>Add / Raw(b"xxxxx"), to both packets above if we keep this testcase.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ with TestPmd() as testpmd:<br>
+ testpmd.set_vlan_filter(0, True)<br>
+ testpmd.set_vlan_extend(0, True)<br>
+ testpmd.rx_vlan(100, 0, True)<br>
+ self._send_packet_and_verify(packets[0], testpmd, should_receive=True)<br>
+ self._send_packet_and_verify(packets[1], testpmd, should_receive=False)<br>
+<br></blockquote><div><br></div><div>The testcase does look good except that form what I'm seeing, vlan_filter is not supported for 88a8 + 8100 packets (it won't read the 88a8 tag). I sent Bruce and Morten an email about it. But, I think the most reasonable thing is to remove this testcase for the 25.11 release since the expected behavior is either not well defined, or vlan_filter is not supposed to be able to read 88a8 tags.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ @func_test<br>
+ def test_qinq_forwarding(self) -> None:<br>
+ """QinQ Rx filter test case.<br>
+<br>
+ Steps:<br>
+ Launch testpmd with mac forwarding mode.<br>
+ Disable VLAN filter mode on port 0.<br>
+ Send test packet and capture verbose output.<br>
+<br>
+ Verify:<br>
+ Check that the received packet has two separate VLAN layers in proper QinQ fashion.<br>
+ Check that the received packet outer and inner VLAN layer has the appropriate ID.<br>
+ """<br>
+ test_packet = (<br>
+ Ether(dst="ff:ff:ff:ff:ff:ff")<br>
+ / Dot1AD(vlan=100)<br>
+ / Dot1Q(vlan=200)<br>
+ / IP(dst="1.2.3.4")<br>
+ / UDP(dport=1234, sport=4321)<br>
+ / Raw(load="xxxxx")<br>
+ )<br>
+ with TestPmd() as testpmd:<br>
+ testpmd.set_vlan_filter(0, False)<br>
+ testpmd.start()<br>
+ received_packets = send_packet_and_capture(test_packet)<br>
+ packet = self._get_relevant_packet(received_packets)<br>
+<br>
+ verify(packet is not None, "Packet was dropped when it should have been received.")<br>
+<br>
+ if packet is not None:<br>
+ verify(bool(packet.haslayer(Dot1AD)), "QinQ layer not found in packet")<br></blockquote><div><br></div><div>I guess you can also verify that packet haslayer(Dot1Q)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ if outer_vlan := packet.getlayer(Dot1AD):<br>
+ outer_vlan_id = outer_vlan.vlan<br>
+ verify(<br>
+ outer_vlan_id == 100,<br>
+ f"Outer VLAN ID was {outer_vlan_id} when it should have been 100.",<br>
+ )<br>
+ else:<br>
+ verify(False, "VLAN layer not found in received packet.")<br>
+<br>
+ if outer_vlan and (inner_vlan := outer_vlan.getlayer(Dot1Q)):<br>
+ inner_vlan_id = inner_vlan.vlan<br>
+ verify(<br>
+ inner_vlan_id == 200,<br>
+ f"Inner VLAN ID was {inner_vlan_id} when it should have been 200",<br>
+ )<br>
+<br>
+ @requires_nic_capability(NicCapability.RX_OFFLOAD_QINQ_STRIP)<br>
+ @func_test<br>
+ def test_qinq_strip(self) -> None:<br>
+ """Test combinations of VLAN/QinQ strip settings with various QinQ packets.<br>
+<br>
+ Steps:<br>
+ Launch testpmd with QinQ and VLAN strip enabled.<br>
+ Send four VLAN/QinQ related test packets.<br>
+<br>
+ Verify:<br>
+ Check received packets have the expected VLAN/QinQ layers/tags.<br>
+ """<br>
+ test_packets = [<br>
+ Ether() / Dot1Q() / IP() / UDP(dport=1234, sport=4321) / Raw(load="xxxxx"),<br>
+ Ether()<br>
+ / Dot1Q(vlan=100)<br>
+ / Dot1Q(vlan=200)<br>
+ / IP()<br>
+ / UDP(dport=1234, sport=4321)<br>
+ / Raw(load="xxxxx"),<br>
+ Ether() / Dot1AD() / IP() / UDP(dport=1234, sport=4321) / Raw(load="xxxxx"),<br>
+ Ether() / Dot1AD() / Dot1Q() / IP() / UDP(dport=1234, sport=4321) / Raw(load="xxxxx"),<br>
+ ]<br>
+ with TestPmd() as testpmd:<br>
+ testpmd.set_qinq_strip(0, True)<br>
+ testpmd.set_vlan_strip(0, True)<br>
+ testpmd.start()<br>
+<br>
+ received_packets1 = send_packet_and_capture(test_packets[0])<br>
+ packet1 = self._get_relevant_packet(received_packets1)<br>
+ received_packets2 = send_packet_and_capture(test_packets[1])<br>
+ packet2 = self._get_relevant_packet(received_packets2)<br>
+ received_packets3 = send_packet_and_capture(test_packets[2])<br>
+ packet3 = self._get_relevant_packet(received_packets3)<br>
+ received_packets4 = send_packet_and_capture(test_packets[3])<br>
+ packet4 = self._get_relevant_packet(received_packets4)<br></blockquote><div><br></div><div>rename to make them more descriptive? I.e. vlan_packet, 2_vlan_packet, qinq_packet, qinq_vlan_packet? Or similar.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ testpmd.stop()<br>
+<br>
+ tests = [<br>
+ ("Single 8100 tag", self._strip_verify(packet1, False, "Single 8100 tag")),<br>
+ (<br>
+ "Double 8100 tag",<br>
+ self._strip_verify(packet2, True, "Double 8100 tag"),<br>
+ ),<br>
+ ("Single 88a8 tag", self._strip_verify(packet3, False, "Single 88a8 tag")),<br>
+ (<br>
+ "QinQ (88a8 and 8100 tags)",<br>
+ self._strip_verify(packet4, False, "QinQ (88a8 and 8100 tags)"),<br>
+ ),<br>
+ ]<br></blockquote><div><br></div><div>this is good for testing behavior when we have both vlan_strip and qinq_strip enabled. What about when we have only vlan_strip enabled or only qinq_strip enabled? I.e. when we have only vlan_strip enabled, and we send an 88a8 only packet, nothing should get stripped at all. It probably makes sense to have different testcases for vlan strip, qinq_strip, and vlan_strip + qinq_strip.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ failed = [ctx for ctx, result in tests if not result]<br>
+<br>
+ verify(<br>
+ not failed,<br>
+ f"The following packets were not stripped correctly: {', '.join(failed)}",<br>
+ )<br>
-- <br>
2.51.0<br>
<br></blockquote><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>> </div></div></div>
</div>