test suite reviews and discussions
 help / color / mirror / Atom feed
From: Ke Xu <ke1.xu@intel.com>
To: dts@dpdk.org
Cc: qi.fu@intel.com, weiyuanx.li@intel.com, lijuan.tu@intel.com,
	ke1.xu@intel.com
Subject: [DTS][PATCH V3 4/5] tests/vf_offload: Improve tcpdump_analyse_sniff method
Date: Wed, 28 Dec 2022 13:15:02 +0800	[thread overview]
Message-ID: <20221228051503.36747-5-ke1.xu@intel.com> (raw)
In-Reply-To: <20221228051503.36747-1-ke1.xu@intel.com>

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 | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 51313743..7a66229a 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -628,17 +628,11 @@ 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):
-- 
2.25.1


  parent reply	other threads:[~2022-12-28  5:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28  5:14 [DTS][PATCH V3 0/5] Improve checksum validate and tso packet counting Ke Xu
2022-12-28  5:14 ` [DTS][PATCH V3 1/5] tests/vf_offload: Improve checksum_validate method Ke Xu
2022-12-28  5:15 ` [DTS][PATCH V3 2/5] tests/vf_offload: Remove redundant variable used Ke Xu
2022-12-28  5:15 ` [DTS][PATCH V3 3/5] tests/vf_offload: Use modified checksum_validate to replace checksum_validate_tunnel Ke Xu
2022-12-28  5:15 ` Ke Xu [this message]
2022-12-28  5:15 ` [DTS][PATCH V3 5/5] tests/vf_offload: Replace the tcpdump implementation to a packet reading implementation Ke Xu
2022-12-28  6:08   ` Li, WeiyuanX
2023-01-03  6:05 ` [DTS][PATCH V3 0/5] Improve checksum validate and tso packet counting Fu, Qi
2023-01-04  1:08 ` Tu, Lijuan

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=20221228051503.36747-5-ke1.xu@intel.com \
    --to=ke1.xu@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    --cc=qi.fu@intel.com \
    --cc=weiyuanx.li@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).