From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 55C2CA04FD; Wed, 28 Dec 2022 06:16:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 516D5410E5; Wed, 28 Dec 2022 06:16:43 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id CBB7B40FDF for ; Wed, 28 Dec 2022 06:16:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672204601; x=1703740601; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nF13wOY19r+dvVwLhkFyA2gU3PsUsDbV8VYxe2R1/1M=; b=MKG7EV6nYV4o6g2UrONfxCrGpT1T8VLanJjDYcNv7WMBMIfm+1LMtMJ/ DQT1aLY2JNBhp+wIoSFuLpy0MmAgPQcrs/HRozU9qkRGu/ZF4SaeauKzd MjblnrjmXqHk8WIiTrdXQMBS3wCiE75yWWv+aQdN3AUY9Zj4nNymtRU8v gOCxGyyT0lJ8SYi2SaxtvbZc7NdC5LfY5inG79BYS91FpsJxUhR2tJGgX DN8+oDxTwgp3EomY6F8R9SXfJcAH+nLjreSfNkcwBZE6OUikdN0dT5gyE d23ZqcpahCS2jnqzHRa+mCyFVRRXESoy0eimkNXOy0Uo7I+v6vjxG3DHD g==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="348008018" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="348008018" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 21:16:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="603234372" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="603234372" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga003.jf.intel.com with ESMTP; 27 Dec 2022 21:16:39 -0800 From: Ke Xu 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 Message-Id: <20221228051503.36747-5-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221228051503.36747-1-ke1.xu@intel.com> References: <20221228051503.36747-1-ke1.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org 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 --- 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