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 73C06A04FD; Tue, 27 Dec 2022 11:25:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DC48410FC; Tue, 27 Dec 2022 11:25:33 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 2DF0640E2D for ; Tue, 27 Dec 2022 11:25:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672136731; x=1703672731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X7Bnt1WTgmyszdwlgr4TPk0pCFNccZq++5dL8Y3JWWA=; b=YB2m4T0rZaXRxujDrVyYdb/rlVK3f4VnH9wOBv4NuOmivCe4xW96O+nu 8RikM6bVDltp8CKf7VHWGBhq5HCfNxWLzAmpGCQS2osGFxo/8VX2j3D69 OitzRG4HnwE38CAtMarM/ji8CMoEN/zgQO1+kwuFoZH7Etat3JaozRPUg 2KjCaBj4594FX5FlcNsk4PvsAdXqEluzersaFSRqHr2c+QCjfawq6XQ6i rVN62ZjfgsJpmG1GD/Oj7KiZOAM4wFf7Rxm0kEDXl0+QTtNnIpYw9FyIs yfRg5JE3HMLRHciFOKxBEcyPPIr8Gs7v0dS2ztAmxkMwOZIyjDdHuDZqC w==; X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="322656489" X-IronPort-AV: E=Sophos;i="5.96,278,1665471600"; d="scan'208";a="322656489" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 02:25:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="760292263" X-IronPort-AV: E=Sophos;i="5.96,278,1665471600"; d="scan'208";a="760292263" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by fmsmga002.fm.intel.com with ESMTP; 27 Dec 2022 02:25:28 -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 V1 4/5] tests/vf_offload: Improve tcpdump_analyse_sniff method Date: Tue, 27 Dec 2022 18:21:35 +0800 Message-Id: <20221227102131.529684-5-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221227102131.529684-1-ke1.xu@intel.com> References: <20221227102131.529684-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 d6f2a134..eb702559 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