[V2,4/5] tests/vf_offload: Improve tcpdump_analyse_sniff method

Message ID 20221228050850.33004-5-ke1.xu@intel.com (mailing list archive)
State Superseded
Headers
Series Improve checksum validate and tso packet counting. |

Commit Message

Ke Xu Dec. 28, 2022, 5:08 a.m. UTC
  Use newly added filter_packets method to replace the packet filtering.

Calculate p[Raw].load to fix possible wrongly calculated payload
 size when there are paddings.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 tests/TestSuite_vf_offload.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
  

Patch

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index bccffb3d..a9d587e9 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -622,17 +622,9 @@  class TestVfOffload(TestCase):
         packets and the bytes of packets payload.
         """
         packet = Packet()
-        pkts = packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester)
-        pkts = [
-            p
-            for p in pkts
-            if len(p.layers()) >= 3
-            and p.layers()[1] in {IP, IPv6}
-            and p.layers()[2] in {IP, IPv6, UDP, TCP, SCTP, GRE, MPLS}
-            and Raw in p
-        ]
+        pkts = self.filter_packets(packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester))
         rx_packet_count = len(pkts)
-        rx_packet_size = [len(p[Raw]) for p in pkts]
+        rx_packet_size = [len(p[Raw].load) for p in pkts]
         return rx_packet_count, rx_packet_size
 
     def tcpdump_command(self, command):