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 D55CC45CF8; Wed, 13 Nov 2024 17:25:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50FEE40E15; Wed, 13 Nov 2024 17:25:28 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 082334025E for ; Wed, 13 Nov 2024 17:25:26 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E6201480; Wed, 13 Nov 2024 08:25:55 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.58.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E504A3F66E; Wed, 13 Nov 2024 08:25:24 -0800 (PST) From: Luca Vizzarro To: dev@dpdk.org Cc: Paul Szczepanek , Patrick Robb , Luca Vizzarro Subject: [PATCH v4 1/3] dts: fix adjust L2/L3 addresses behavior Date: Wed, 13 Nov 2024 16:25:14 +0000 Message-ID: <20241113162518.643764-3-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241113162518.643764-1-luca.vizzarro@arm.com> References: <20240806125140.2582859-1-luca.vizzarro@arm.com> <20241113162518.643764-1-luca.vizzarro@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The _adjust_addresses function has been updated to both modify the original packets and return new updated copies of them. Having a double behavior even if documented is not intuitive and can lead to bugs. This changes the behavior to solely act on copies, leaving the original packet untouched. Fixes: 1a1825962777 ("dts: rework packet addressing") Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/framework/test_suite.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index fb5d646ce3..5b3e7c205e 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -324,8 +324,7 @@ def get_expected_packet(self, packet: Packet) -> Packet: def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]: """L2 and L3 address additions in both directions. - Packets in `packets` will be directly modified in this method. The returned list of packets - however will be copies of the modified packets. + Copies of `packets` will be made, modified and returned in this method. Only missing addresses are added to packets, existing addresses will not be overridden. If any packet in `packets` has multiple IP layers (using GRE, for example) only the inner-most @@ -343,7 +342,9 @@ def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> li A list containing copies of all packets in `packets` after modification. """ ret_packets = [] - for packet in packets: + for original_packet in packets: + packet = original_packet.copy() + # update l2 addresses # If `expected` is :data:`True`, the packet enters the TG from SUT, otherwise the # packet leaves the TG towards the SUT. -- 2.43.0