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 093F84586E; Mon, 26 Aug 2024 23:22:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FB7040B9C; Mon, 26 Aug 2024 23:22:34 +0200 (CEST) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by mails.dpdk.org (Postfix) with ESMTP id C1F7240A7A for ; Mon, 26 Aug 2024 23:22:32 +0200 (CEST) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e116b591e15so5052256276.3 for ; Mon, 26 Aug 2024 14:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724707352; x=1725312152; 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=It7eniDwhrS6IhWcYRY49+d2Z8/Fg1iVe7ngL7GVQZg=; b=Mo1DO9XdrJKn8UtkzmB0TG6oGc5Y0c/YK7TUvGVPKlrthvpFNtBhdJelNw6qU85+tg 4SOvfzrviMHKN1upbicDRiqu6L224rHuseGOpBj59F3DEHD1jDLYgJTCCboWqCQ26o1p bHtPrSGiSXhl16rjmSwKCczGooumiMguD4QVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724707352; x=1725312152; 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=It7eniDwhrS6IhWcYRY49+d2Z8/Fg1iVe7ngL7GVQZg=; b=QUtEEGCq1/MDUHST5HV2jUuJepNp9mqocq3JEz8gRqxqoaCmUJjFZEP1FebFZ5yyjH 8udxWLtRrcYcuuSkALRe7jubIg48iSNLfk7M6BWkMvczhmTZzWHhDR23Xbq1zvsZF99w n7+XrPQWEELOaXLYfDi7ykNWa3zExy/NSlwmn/BpkdgAiIFS0yvJLaqi1IVV7O+lW1Zy EBApHiwTC8dE1b/EpWzK8iQKehhAAkaod6MNQ92ux1wNi/nK4tHhdimbqolKSsVmheBs qzbbywpBVGLN26BcXqQDxT0+vxcvEy6CIb25WdeT4VJY/R1NqsXdWBZTjnCc2Y73qxjy dTcQ== X-Gm-Message-State: AOJu0YwxuNqITg3sljfOpEe/UIpSRYOCrx1KRjKnUKxAJg4c+PHHy6je DfOzm7eARaS7xmIvj9XCi1JuBITzKI/yTxA9CwFruuqj4mXuqSGQNbP9ToUIh40= X-Google-Smtp-Source: AGHT+IFVZinc/3AKtwr1rh7mp45KQAaL9+2td2johWZbknFF23YPEyiM9x/CRDg9afNktbfm3TvsKQ== X-Received: by 2002:a25:9389:0:b0:e17:bd74:f2a7 with SMTP id 3f1490d57ef6-e17bd751af6mr7749081276.44.1724707351935; Mon, 26 Aug 2024 14:22:31 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1210:52ef:3eaf:5f1e:6f6a]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c162db0c18sm50192046d6.96.2024.08.26.14.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 14:22:31 -0700 (PDT) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v3 1/2] dts: add csum HW offload to testpmd shell Date: Mon, 26 Aug 2024 17:22:49 -0400 Message-ID: <20240826212250.26993-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240826212250.26993-1-dmarx@iol.unh.edu> References: <20240821162550.1163-1-dmarx@iol.unh.edu> <20240826212250.26993-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. Port over set_verbose and port start/stop from queue start/stop suite. Signed-off-by: Dean Marx --- dts/framework/remote_session/testpmd_shell.py | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 43e9f56517..f0074be9ef 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -334,6 +334,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 DeviceErrorHandlingMode(StrEnum): """Enum representing the device error handling mode.""" @@ -806,6 +823,40 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) + def csum_set_hw(self, layer: ChecksumOffloadOptions, port_id: int, verify: bool = True) -> None: + """Enables hardware checksum offloading on the specified layer. + + Args: + layer: The layer 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 layer: + 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 "-" in name: + name.title() + else: + name.upper() + if f"{name} checksum offload is hw" in csum_output: + success = True + if not success and verify: + self._logger.debug(f"Failed to set csum hw mode on port {port_id}:\n{csum_output}") + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.44.0