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 6773D45CB5; Fri, 8 Nov 2024 18:01:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B63B443400; Fri, 8 Nov 2024 18:01:47 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id D431F433FE for ; Fri, 8 Nov 2024 18:01:45 +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 2466A497; Fri, 8 Nov 2024 09:02:15 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.59.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 781193F6A8; Fri, 8 Nov 2024 09:01:44 -0800 (PST) From: Luca Vizzarro To: dev@dpdk.org Cc: Paul Szczepanek , Patrick Robb , Luca Vizzarro Subject: [PATCH v3 1/3] dts: fix adjust L2/L3 addresses behavior Date: Fri, 8 Nov 2024 17:01:36 +0000 Message-ID: <20241108170138.203096-2-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241108170138.203096-1-luca.vizzarro@arm.com> References: <20240806125140.2582859-1-luca.vizzarro@arm.com> <20241108170138.203096-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