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 1D798457A1; Mon, 12 Aug 2024 15:41:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC3A840A6D; Mon, 12 Aug 2024 15:41:10 +0200 (CEST) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mails.dpdk.org (Postfix) with ESMTP id C8276409FA for ; Mon, 12 Aug 2024 15:41:09 +0200 (CEST) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7a1d067d5bbso290671385a.3 for ; Mon, 12 Aug 2024 06:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723470069; x=1724074869; 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=iym8gZwjGImD0eWWTPXCrrWM9o8jikvucJ/hNRw6x6E=; b=Dfa/Ypk5YcaPLidrxQrFGxLfKWt8v0wWjIJ25Qnk0KbW8u8WWB24VhLMt43qrma8Kc yO9yoradfVuNEggCha0BBdMjLZAhWSoQX/n5J7gMGaLy/z+Z7fwXnZF+VnJREhEi5maQ E3fEbyQqkUR8SdQlUlYIBjkSBcPTOVjEb8tg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723470069; x=1724074869; 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=iym8gZwjGImD0eWWTPXCrrWM9o8jikvucJ/hNRw6x6E=; b=NBrXE/EGMVA1aEd5AKaUsNgOEwAxjr4FwAr23NT8Nt1+EiPAfhifvtWxsJKqshEgAr x18+Bv8lOd3WwIAbMsZaRWcvqXPCfiRoycMcn04aztr8oFJEcrDpgTqjcB8UUadXtXDJ knKr3RbjNabrnKGUNV8TR+UvASRmv1jhMGP6CYS/ol+ZCnyl8f5RsU2ua9dGf1Jq3e56 /6Uc/SxiWSCb9vFr3h95Tdax1YUgL5S3dcjwTH1fgdF1AEhUgKRQZWGZ0oa33XWpR22Y 6I+kRhZvtrfM58n/vNGxyfucPxXhDDODp5geZV0RkCwpxL8zsSGbRBq6Haxws7EWdEZL QXhw== X-Gm-Message-State: AOJu0YyDks7HlWvxylrB4Rq7mjwX+HM9k6lgAXQK+Tof0T61/n7Aszib JVvoQtjIwLty1JEmFUrfZQnpJzc7pj6vuU3vG9Ms3RHmBmq752LIKoWH3/njZw0= X-Google-Smtp-Source: AGHT+IH714pRz2hodeip8AatE3fpmJPGAsoNzZrx3mXtUR/WZe4CVpceaISAQBeed3KOnwleta5a6w== X-Received: by 2002:a05:620a:3954:b0:79d:76c3:5309 with SMTP id af79cd13be357-7a4e150d31emr26593785a.4.1723470069015; Mon, 12 Aug 2024 06:41: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-7a4c7d624c7sm247544785a.23.2024.08.12.06.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:41:08 -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: [RFC v1 1/2] dts: add csum HW offload to testpmd shell Date: Mon, 12 Aug 2024 09:41:23 -0400 Message-ID: <20240812134124.27637-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240812134124.27637-1-dmarx@iol.unh.edu> References: <20240812134124.27637-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 | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 43e9f56517..be8fbdc295 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -806,6 +806,100 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) + def port_stop(self, port: int, verify: bool = True): + """Stop specified port. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure specified port is stopped. If not, it is considered + an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the port + is not stopped.""" + port_output = self.send_command(f"port stop {port}") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to stop port {port}: \n{port_output}") + raise InteractiveCommandExecutionError(f"Testpmd failed to stop port {port}.") + + def port_start(self, port: int, verify: bool = True): + """Start specified port. + + Args: + port: Specifies the port number to use, must be between 0-32. + verify: If :data:`True`, the output of the command is scanned + to ensure specified port is started. If not, it is considered + an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the port + is not started.""" + port_output = self.send_command(f"port start {port}") + if verify: + if "Done" not in port_output: + self._logger.debug(f"Failed to start port {port}: \n{port_output}") + raise InteractiveCommandExecutionError(f"Testpmd failed to start port {port}.") + + def csum_set_hw(self, layer: str, 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. + options: tcp, ip, udp, sctp, outer-ip, outer-udp. + 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. + """ + csum_output = self.send_command(f"csum set {layer} hw {port_id}") + if (verify and ("Bad arguments" in csum_output or f"Please stop port {port_id} first")): + 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}" + ) + if verify and f"checksum offload is not supported by port {port_id}" in csum_output: + self._logger.debug(f"Checksum {layer} offload is not supported by port {port_id}:\n{csum_output}") + + success = False + if "outer-ip" in layer: + if "Outer-Ip checksum offload is hw" in csum_output: + success = True + if "outer-udp" in layer: + if "Outer-Udp checksum offload is hw" in csum_output: + success = True + else: + if f"{layer.upper} 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 set_verbose(self, level: int, verify: bool = True) -> None: + """Set debug verbosity level. + + Args: + level: 0 - silent except for error + 1 - fully verbose except for Tx packets + 2 - fully verbose except for Rx packets + >2 - fully verbose + verify: if :data:`True` an additional command will be sent to verify that verbose level + is properly set. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and verbose level + is not correctly set. + """ + verbose_output = self.send_command(f"set verbose {level}") + if verify: + if "Change verbose level" not in verbose_output: + self._logger.debug(f"Failed to set verbose level to {level}: \n{verbose_output}") + raise InteractiveCommandExecutionError( + f"Testpmd failed to set verbose level to {level}." + ) + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.44.0