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 19B0545B3B; Mon, 14 Oct 2024 20:23:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B59A44064C; Mon, 14 Oct 2024 20:23:00 +0200 (CEST) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by mails.dpdk.org (Postfix) with ESMTP id CDD67402E3 for ; Mon, 14 Oct 2024 20:22:57 +0200 (CEST) Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6cbcd49b833so38158846d6.3 for ; Mon, 14 Oct 2024 11:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1728930177; x=1729534977; 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=Q0EBi/MMG84awmsVdvM8MDv88MNsChTDofMJK3qfiAylRrzVaBGhY9toffzEtt8w6N maa/bzJP86GAVHbt264H1PPLEXbx+AB1rEiySVflWYZXePMm+R7fga3bHHoQNQdyHbr3 IjIfVX1vnGLq+F8gVs778DWugarYwg82uj8KI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728930177; x=1729534977; 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=psVRYC7qmOpViN2sVd5gBuhojy9PhDGj+tFxul6D+lxJv751/ifwrZEo0vIWa/c5jw IPW66UOOyuGOJ4rgi2nzwOdb6AClL3C0q4H2/8OoakiAnPmJN/qHEm0S0AkLC0c5M9WV wC5WlPcD6mUCOp2eWI5sSOhOrTWm7eIOfH4DQTES+QtsCKU4TgU3yInQQw9j5vyW6qNX gHrxvR820Njtmdu0H9O2V6AoYEfPYOywpbZJ9gIRiygztjsjHjEp0BafFrCOx01q+W8P NTTeg91rRsLOjqPDq6MurB7A1Sfr4FVLJZ6cgbOY4+dHtOhqlmTPZW6WR2wKLssdwW81 DZ+Q== X-Gm-Message-State: AOJu0YyXBkqREnBU6J6bUAM8Gf1i74MDQT+AEFZRCDt8y+3E+wqT3Fc3 A6O9Z3CKOs3o9uxrsyIGay/y4BE3m5iPoVU6KaxtbYGggNV3j3ftrLsOwLUAugI= X-Google-Smtp-Source: AGHT+IFhzlT9zUtuw7yHVukk57dBVK2Zropy55eR5ocE7y//7xjWdkr4do7Uk4ESHWTuoT6q69fxgA== X-Received: by 2002:a05:6214:5c01:b0:6cb:22ea:5e07 with SMTP id 6a1803df08f44-6cbf9d5e400mr160397696d6.30.1728930177140; Mon, 14 Oct 2024 11:22:57 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cbe86322a7sm47989366d6.116.2024.10.14.11.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 11:22:56 -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 v4 1/2] dts: add csum HW offload to testpmd shell Date: Mon, 14 Oct 2024 14:23:19 -0400 Message-ID: <20241014182320.31125-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241014182320.31125-1-dmarx@iol.unh.edu> References: <20240826212250.26993-1-dmarx@iol.unh.edu> <20241014182320.31125-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