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 D375A45FA4; Tue, 31 Dec 2024 12:24:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6004D40272; Tue, 31 Dec 2024 12:24:45 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 0998C40263 for ; Tue, 31 Dec 2024 12:24:44 +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 9460F1596; Tue, 31 Dec 2024 03:25:11 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.72.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BBE153F6A8; Tue, 31 Dec 2024 03:24:42 -0800 (PST) From: Paul Szczepanek To: dev@dpdk.org Cc: probb@iol.unh.edu, Paul Szczepanek , Thomas Wilks Subject: [PATCH v1 1/2] dts: allow expected packets to come from the TG Date: Tue, 31 Dec 2024 11:24:12 +0000 Message-Id: <20241231112413.1509989-1-paul.szczepanek@arm.com> X-Mailer: git-send-email 2.39.2 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 Add sent_from_tg variable to get_expected_packets for when packets are sent from the TG. Signed-off-by: Thomas Wilks Signed-off-by: Paul Szczepanek --- dts/framework/test_suite.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index adee01f031..69b24fd126 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -274,31 +274,41 @@ def send_packets( packets = self._adjust_addresses(packets) self.tg_node.send_packets(packets, self._tg_port_egress) - def get_expected_packets(self, packets: list[Packet]) -> list[Packet]: + def get_expected_packets( + self, + packets: list[Packet], + sent_from_tg: bool = False, + ) -> list[Packet]: """Inject the proper L2/L3 addresses into `packets`. Inject the L2/L3 addresses expected at the receiving end of the traffic generator. Args: packets: The packets to modify. + sent_from_tg: True if packet was sent from the TG. Returns: `packets` with injected L2/L3 addresses. """ - return self._adjust_addresses(packets, expected=True) + return self._adjust_addresses(packets, not sent_from_tg) - def get_expected_packet(self, packet: Packet) -> Packet: + def get_expected_packet( + self, + packet: Packet, + sent_from_tg: bool = False, + ) -> Packet: """Inject the proper L2/L3 addresses into `packet`. Inject the L2/L3 addresses expected at the receiving end of the traffic generator. Args: packet: The packet to modify. + sent_from_tg: True if packet was sent from the TG. Returns: `packet` with injected L2/L3 addresses. """ - return self.get_expected_packets([packet])[0] + return self.get_expected_packets([packet], sent_from_tg)[0] def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]: """L2 and L3 address additions in both directions. -- 2.39.2