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 4ED3F45A78; Tue, 15 Oct 2024 21:13:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3CF194027F; Tue, 15 Oct 2024 21:13:13 +0200 (CEST) Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by mails.dpdk.org (Postfix) with ESMTP id 20B8140270 for ; Tue, 15 Oct 2024 21:13:10 +0200 (CEST) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7b1123f8f9bso592482985a.1 for ; Tue, 15 Oct 2024 12:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1729019589; x=1729624389; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A3RprZKGSHBmQ41fO4D0x5B+RgqhPcJNUSzAmE7dSHw=; b=AbPULLz2cXeStMOduIzdp4H9DHZN9GfwJBxcmziFXr6E5umLOxR+RattE2qcCrCCgb lmacjpBW6f6aNbUGgqOkfI6GqYJIbPBM/X8Cv7rBPPF00v4EvTjRu326ydj11udvsMHd Q0jQlWnWCyD7GS9WWk1yfpgpF65ts19JS6+7o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729019589; x=1729624389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A3RprZKGSHBmQ41fO4D0x5B+RgqhPcJNUSzAmE7dSHw=; b=clWgpwniHU6E4STmK3LZmS1rEb3LOgOscQDKqZHzlGRhdYvphvhy7wuYF1G4niAI/Z stpxj8ZreddXaZzVF596nsI+C0oILcIZHli9L+At+Ebx9kmUi7LNa9ebI4/RHnfgm6o5 yRUI+DVR31jzrlfUN0UbMarMNnLuqcoCzYvPq/qUd29nZpBhEiZXTmZW23GrIqbj/oX8 QLvUHdxdVhNgb7sBGFtVSRDU+O6ZROZepl+9N4Sy5uHnzEOVIBIcoj5igXmpAB/qPLZn 0hcyC/hjOIyuivYnvs0fDQOIbI/bWoY1OJY8pOuXtZ6gl1tmlfwgRkFwqII/1zWCnCT6 IlDQ== X-Gm-Message-State: AOJu0YycRD7mz3j4qddOO5krNeivg3pQSUb+9PTrGyD08hjLjjrXK7xS r41fuaMSHGPhXYc590g8DzQMNCN6zEtZejIhJJuTiyFVfDNKdzCEOnvNG8PPmDE= X-Google-Smtp-Source: AGHT+IEa2DP1BvmV+Pnq1gR1fqU4y6CgHEfco0K/Kl55av2T/S0ViwJLfEuKrZBJUlrpDxTGe6PMww== X-Received: by 2002:a05:620a:1a28:b0:7b1:4073:e8c9 with SMTP id af79cd13be357-7b14073eb35mr237560885a.20.1729019589481; Tue, 15 Oct 2024 12:13:09 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b13639512bsm102365485a.77.2024.10.15.12.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 12:13:08 -0700 (PDT) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v5 1/2] dts: add csum HW offload to testpmd shell Date: Tue, 15 Oct 2024 15:13:32 -0400 Message-ID: <20241015191333.12947-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241015191333.12947-1-dmarx@iol.unh.edu> References: <20241014182320.31125-1-dmarx@iol.unh.edu> <20241015191333.12947-1-dmarx@iol.unh.edu> 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 csum_set_hw method to testpmd shell class. Signed-off-by: Dean Marx --- dts/framework/remote_session/testpmd_shell.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 16b41a7814..aa1f2a58ca 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -126,6 +126,23 @@ def make_parser(cls) -> ParserFn: ) +class ChecksumOffloadOptions(Flag): + """Flag representing checksum hardware offload layer options.""" + + #: + ip = auto() + #: + udp = auto() + #: + tcp = auto() + #: + sctp = auto() + #: + outer_ip = auto() + #: + outer_udp = auto() + + class RSSOffloadTypesFlag(Flag): """Flag representing the RSS offload flow types supported by the NIC port.""" @@ -1702,6 +1719,47 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) + @requires_stopped_ports + def csum_set_hw( + self, layers: ChecksumOffloadOptions, port_id: int, verify: bool = True + ) -> None: + """Enables hardware checksum offloading on the specified layer. + + Args: + layers: The layer/layers that checksum offloading should be enabled on. + port_id: The port number to enable checksum offloading on, should be within 0-32. + verify: If :data:`True` the output of the command will be scanned in an attempt to + verify that checksum offloading was enabled on the port. + + Raises: + InteractiveCommandExecutionError: If checksum offload is not enabled successfully. + """ + for name, offload in ChecksumOffloadOptions.__members__.items(): + if offload in layers: + name = name.replace("_", "-") + csum_output = self.send_command(f"csum set {name} hw {port_id}") + if verify: + if ( + "Bad arguments" in csum_output + or f"Please stop port {port_id} first" in csum_output + or f"checksum offload is not supported by port {port_id}" in csum_output + ): + self._logger.debug(f"Csum set hw error:\n{csum_output}") + raise InteractiveCommandExecutionError( + f"Failed to set csum hw {name} mode on port {port_id}" + ) + success = False + if f"{name} checksum offload is hw" in csum_output.lower(): + success = True + if not success and verify: + self._logger.debug( + f"Failed to set csum hw mode on port {port_id}:\n{csum_output}" + ) + raise InteractiveCommandExecutionError( + f"""Failed to set csum hw mode on port + {port_id}:\n{csum_output}""" + ) + @requires_stopped_ports def set_port_mtu(self, port_id: int, mtu: int, verify: bool = True) -> None: """Change the MTU of a port using testpmd. -- 2.44.0