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 EDEC8A0540; Wed, 28 Dec 2022 06:10:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8B0542D17; Wed, 28 Dec 2022 06:10:29 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id EB9D740FDF for ; Wed, 28 Dec 2022 06:10:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672204228; x=1703740228; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kGbxOvz4rNOyqZwTCK1rzJPQyis6O8PCtmxbkDSE0Ec=; b=jx8vU8q7maoaof/pzc3WmGInY2oxy6shYEeFju/FGipL6qV3rnkhvU67 R39mjseMUGWJSjSrW5ZFnyrikdIWc7gATstWgxREGGaBpImNDox4AEN15 7KY6XEaRmsIdIBzFqun6AFLMRQ3yxPXu5vGiWerqPFTWAlbt1d84TEzvP P9rPkfoDsXp9Cpqy5ye8YYaqKk1msOKlWvhnWa3xVRzy4KMO3tzOA7vOS sG/W/ZD18V/hzZKH+YXtPfBgKfBYdYYbdyIuVU3Leiw+6MRrnRp/Ymb+z 2T5qxuhtPjerjEMf1VwycIkXzeCMpZtO+WoU3ZtDDL14EyAfIhqc5jIMW A==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="300499476" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="300499476" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 21:10:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="760536370" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="760536370" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by fmsmga002.fm.intel.com with ESMTP; 27 Dec 2022 21:10:26 -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 V2 4/5] tests/vf_offload: Improve tcpdump_analyse_sniff method Date: Wed, 28 Dec 2022 13:08:49 +0800 Message-Id: <20221228050850.33004-5-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221228050850.33004-1-ke1.xu@intel.com> References: <20221228050850.33004-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 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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): -- 2.25.1