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 B9883460F6; Fri, 24 Jan 2025 21:44:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E258402CC; Fri, 24 Jan 2025 21:44:40 +0100 (CET) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by mails.dpdk.org (Postfix) with ESMTP id AB81E40151 for ; Fri, 24 Jan 2025 21:44:38 +0100 (CET) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b9b003e7bfso33369985a.3 for ; Fri, 24 Jan 2025 12:44:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1737751478; x=1738356278; 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=l3ON+zcs9qU/ipca9TK8Nd7s8b7NYCPE62sR95IfG1I=; b=RTyxkeXkPAI03vPf6wJCDHa9BwQVQcAA1LNaqfLblFH4yLQNH5cC/Xlv7WBWHHsLP5 nEIGGni09nH7IpbhsdIi84L6azwW+2zkinOMDe+fuGSDxjS1yGgQFACKIuyjtA+U7NMu G6sebcoHIRvtTCfFpnE50ZD1h8M9yhD++VTMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737751478; x=1738356278; 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=l3ON+zcs9qU/ipca9TK8Nd7s8b7NYCPE62sR95IfG1I=; b=jYQlKmzuPEuco4Nh+HChK2jusQnhm0HAoeyJF2/rXRKY/HBH4d8TPUlBy11FsvzPAh v5KZ0d0IrSJJR+1IRoqFXbJnCqdwjDriR4t07CA+YD22CqXs2+F8ZZuAGksBxTt0+D8B DyNTLxr8TViZjQE9tswl0i/31gebr39prrZLiCTaleLWr3k/j94E0DpXo20yR0HxxlpH 1ieypPcseS9INhA7FnUgBasw74lNrSeFosk9YlgSrAbaOt/NU3BKOqC8ICx0Il9IQNLP 5JyXkCVsPVASrsXkxEANEWpjkEUtQq1s/VQ6Fc+9qymVqw1dpo/4NpHy2ADOPSMzGlDB WPUQ== X-Gm-Message-State: AOJu0YyVv9hZ9ic0jN/zh6s0TfOlWt4LevHwD2/hTfZ7VRPw4qp9ihO0 qjt+id3nEv3WU7L6CspG4q4j8uYt8zDV9Hq7BoWEYlZy+b5wAsHucQBMm+wjvok= X-Gm-Gg: ASbGncuARm7b4NKxqSIipzzcgBwTH7aIhjyUiDc8BEapenN7x2mzkq/HefzdhKG0R62 LczE+fRuXXXOUoRrH0XHLrfgnYL92ZJxnJRo9d0FX5XHECcr6ONUqlYSQDUeYDfHZ6j8x5ePI1Z NJ1jftB9hC7sNeCS4NUcE9YqHFeAkERfT8KvVhnaK3a6rQOYES8efx+b81YiBYvWuAx/bd6GQt0 t+0AifzdQHu76BH22Ca5trho9EpybdKJiH3tmwe6S30YezH54pOOOzdxsQWPCFf2gkm4tre+NSd iypvh2SAGhPb3sjlZG0SVCkhXY4i2tbC2gXCm9KikwOdjQ== X-Google-Smtp-Source: AGHT+IEQqVls15YfIq0gjP3+1gBGLACkvb8iBV/RSxH+kpgC62gx6xCXDzSUHeCbp0IouGYb5vNrhg== X-Received: by 2002:a05:622a:2c6:b0:460:9026:6861 with SMTP id d75a77b69052e-46e12a93d96mr180614861cf.9.1737751478054; Fri, 24 Jan 2025 12:44:38 -0800 (PST) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e66b67debsm13482751cf.55.2025.01.24.12.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 12:44:37 -0800 (PST) From: Nicholas Pratte To: yoan.picchi@foss.arm.com, thomas@monjalon.net, luca.vizzarro@arm.com, probb@iol.unh.edu, dmarx@iol.unh.edu, paul.szczepanek@arm.com, stephen@networkplumber.org, ian.stokes@intel.com, thomas.wilks@arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v2 1/2] dts: add fwd restart decorator to rx capabilities Date: Fri, 24 Jan 2025 15:44:32 -0500 Message-ID: <20250124204433.311809-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250124204433.311809-1-npratte@iol.unh.edu> References: <20250117145838.40206-1-npratte@iol.unh.edu> <20250124204433.311809-1-npratte@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 Some testpmd runtime functions require that forwarding be stopped before attempting to execute them, depending on the NIC and vendor. Adding a decorator to these testpmdshell methods to stop, execute, and then start forwarding again abstracts this concern away for test suite developers, and makes for cleaner, easier to read code. Signed-off-by: Nicholas Pratte --- dts/framework/remote_session/testpmd_shell.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index c01ee74b21..c008cb3792 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -1390,6 +1390,28 @@ def _wrapper(self: "TestPmdShell", *args: P.args, **kwargs: P.kwargs): return _wrapper +def requires_forwarding_restart(func: TestPmdShellMethod) -> TestPmdShellMethod: + """Decorator for :class:`TestPmdShell` commands methods that requires forwarding restart. + + If the decorated method is called while a :class:`TestPmdShell` is actively forwarding, then + forwarding is ceased, the wrapped function is executed, and forwarding is started again. + + Args: + func: The :class:`TestPmdShell` method to decorate. + """ + + @functools.wraps(func) + def _wrapper(self: "TestPmdShell", *args: P.args, **kwargs: P.kwargs): + if self.currently_forwarding: + self._logger.debug("Forwarding needs to be restarted to continue.") + self.stop() + retval = func(self, *args, **kwargs) + self.start() + return retval + + return _wrapper + + def add_remove_mtu(mtu: int = 1500) -> Callable[[TestPmdShellMethod], TestPmdShellMethod]: """Configure MTU to `mtu` on all ports, run the decorated function, then revert. @@ -1438,6 +1460,7 @@ class TestPmdShell(DPDKShell): _command_extra_chars: ClassVar[str] = "\n" ports_started: bool + currently_forwarding: bool def __init__( self, @@ -1462,6 +1485,7 @@ def __init__( name, ) self.ports_started = not self._app_params.disable_device_start + self.currently_forwarding = not self._app_params.auto_start self._ports = None @property @@ -1836,7 +1860,7 @@ def csum_set_hw( {port_id}:\n{csum_output}""" ) - @requires_started_ports + @requires_forwarding_restart @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.47.1