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 EA07646053; Fri, 17 Jan 2025 15:58:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68D2B40DD8; Fri, 17 Jan 2025 15:58:47 +0100 (CET) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by mails.dpdk.org (Postfix) with ESMTP id EC89340C35 for ; Fri, 17 Jan 2025 15:58:45 +0100 (CET) Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-46787dc1621so2512841cf.0 for ; Fri, 17 Jan 2025 06:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1737125925; x=1737730725; 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=ZWxp4YsG5NYO/VQ8KRd078cyAUQ4lZo0uIYsIELsDafNECTSOsl3UHJ2oJDxclqmjp LfkKo+AenwtsoClfudBuDPcDmcLUAVTt5d0LCXsUgxWFkVUymFs3oB5Ac00tsEpKNkGY XTyQ8DA92L0CAFGOs8YGVboMewgmLJgmAeTuM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737125925; x=1737730725; 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=rl5GlOSf9hzsxP8WV0EOmL0nLiqKm0vqz7Altznv/EWCbz5MLm5bajFcKwAIp84mhk pDkjYW8RAvBktPXBNsPAATvA+DIVBR+PkWI1Bk0girU/0cPABPo+7gmT1JMVDZiHfncI t1NZE49EeR0ndhnlHorteZY92be3GK0lXJTGYKb4QqAH597fBEU5mUCeUSbgqQhm45T/ Umwk2BFjyQ3ipu7g/+soasqfVUeYBaIIJJ1BDIyu8kTXztF+0k/7uL6s7QFIEmIICo2x v8g2XyCAw5/CYL9JbN5VWKxXRuyhLbQQ+zRVjYnTnZ5LWMi4xWTKY93pe6GrJ2BR9RlM tgtw== X-Gm-Message-State: AOJu0YzMed9A9dZF82TgODt6gzHAfrJtgwYM/+TGYt6FNhQZo4l0zQ6B 4eimGY2xk7/ci0yNJgRewPQoCAiRrBoGAB1g+hxacA1hhS4jkhzpvSUK+pzud8U= X-Gm-Gg: ASbGncv54PFCUzwMAbczl27nbnvBf80kA/Q19Sq/RUTqTywo1R1Lm1mDI93LEgp4ihH r27za48zDdwtQ62pC+pi2epNRLLSmFzsciNkgIJTvLHrS1fWXP1Wb/RqrZgnq2pBIkJldxszjHX mJvS0/o0WWVkkbFzm3sK2zkQiCs1Cybz88EYIHAuMs/wumqPCTjHn0zjOMy3xOsQbLTze3ZpUNG StmuyR4+iimxfctF+tg45h71zSpVMy8JWFUl6qBhgxZgdWBRHTCu+C7rFsd1u0MOxDw X-Google-Smtp-Source: AGHT+IHpWyplPzw47fAyzkyFtBqgyo8qC+q3khPwQeUJaW/dAxTjW9BjvTgukQsptdM8QhbvlnApeQ== X-Received: by 2002:a05:622a:48c:b0:467:6379:8d2f with SMTP id d75a77b69052e-46e12bb3307mr19132351cf.15.1737125925197; Fri, 17 Jan 2025 06:58:45 -0800 (PST) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e104027d5sm11798291cf.58.2025.01.17.06.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 06:58:44 -0800 (PST) From: Nicholas Pratte To: yoan.picchi@foss.arm.com, ian.stokes@intel.com, probb@iol.unh.edu, stephen@networkplumber.org, Honnappa.Nagarahalli@arm.com, luca.vizzarro@arm.com, thomas@monjalon.net, thomas.wilks@arm.com, dmarx@iol.unh.edu, paul.szczepanek@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v1 1/2] dts: add fwd restart decorator to rx capabilities Date: Fri, 17 Jan 2025 09:58:37 -0500 Message-ID: <20250117145838.40206-2-npratte@iol.unh.edu> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117145838.40206-1-npratte@iol.unh.edu> References: <20250117145838.40206-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