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 3754D43E2D; Wed, 10 Apr 2024 09:50:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCEDB402C5; Wed, 10 Apr 2024 09:50:32 +0200 (CEST) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by mails.dpdk.org (Postfix) with ESMTP id 9C0844029E for ; Wed, 10 Apr 2024 09:50:30 +0200 (CEST) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a51c37a5025so450353166b.1 for ; Wed, 10 Apr 2024 00:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1712735430; x=1713340230; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b80rsm9Hl8WH5nnrI4+Vn4ukZwUJXd5wjjnA7rKMY08=; b=jg2nl9Nl/7ltm9M6l9e0LkgHO5tWuvW9YqIaDbbRe40QIo2hNVcqVK0rohIwMEAGfS BHwuV1tz+1/0b2j91BctLtc/WgygKh284Oja65xi3p36wvk9qCqbvRiUd7oFqJZEMbth 2Dg00+5spsd5CHCpSSgF1vuyIbmkxP23aOziWwEieq1YTmgGKPVLq8gqBaUFO1sLPVnj H5NQH8P5lX6ZCYTDU4a9kCyMqIkomp8zxhlhM85hR01YDPKR7Chrlqu2nCx08IiC55q2 bnxFoPkGRpy+yedr2SWW/L2iiuqv5ZAcD57HS1BISDP/XxKG6omNnb0NWRkzv4ZI9vwn vFGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712735430; x=1713340230; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b80rsm9Hl8WH5nnrI4+Vn4ukZwUJXd5wjjnA7rKMY08=; b=Jqshu9MfZsKer6+8i9QELtL8aon5w39eYLOeYMuFSOyuYlPsRQHIdtNAErN+k5GRZ5 04XlDVbbnhQFUTgeOHhoh00SEuCI76IVowv762gUCJnutpUG9yDtBP+2o2rhrbb5LmuC LdvczUyt2Zx9sKJ0KJw9qxcAgf4lgm4Uv2mEn9m2lBYfpTlLCj1ZCGVaIQggufnde1im WlnsuGPJHtsH/Gv6XwF9l1RKxUOIv2hCa1QQRJGtZT/vI62fiscxkxyc88/CKkSdl7nK +lChKRKZ8Q5NLv5d+IIfE1ZPE+ct5mZYpGo6Sxggz7Cx0z8aH5SY9be4zn3W+FtL5pYV 6qiw== X-Gm-Message-State: AOJu0YyYZg8l+133GhTxndM5Y+9MmqGFh8hr/yp6GlIJYBcJPX+aI8jD LTzhcEExyQONKKRU60n0e9e4zrVVlAq8vkfE7tqYzS5h6KXRzIbRes/ZWlNMNHE7Giw5FkVwfPZ P8/4i5+Kk1CfKkkXpmH17dAHGh+L0ZiKiRe0q/Q== X-Google-Smtp-Source: AGHT+IHIN9c8bCMzK4dGa9+gz+mPvAtc9T65fpZcaD3vVugMIKYF3FGflfGAfDi40a7fHObgSPLSkw147EtLSs3y9aU= X-Received: by 2002:a17:906:fb85:b0:a51:ddc6:cc90 with SMTP id lr5-20020a170906fb8500b00a51ddc6cc90mr926987ejb.70.1712735430119; Wed, 10 Apr 2024 00:50:30 -0700 (PDT) MIME-Version: 1.0 References: <20240326190422.577028-1-luca.vizzarro@arm.com> <20240326190422.577028-7-luca.vizzarro@arm.com> In-Reply-To: <20240326190422.577028-7-luca.vizzarro@arm.com> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Wed, 10 Apr 2024 09:50:19 +0200 Message-ID: Subject: Re: [PATCH 6/6] dts: add statefulness to TestPmdShell To: Luca Vizzarro Cc: dev@dpdk.org, Jack Bond-Preston , Honnappa Nagarahalli Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Tue, Mar 26, 2024 at 8:04=E2=80=AFPM Luca Vizzarro wrote: > > This commit provides a state container for TestPmdShell. It currently > only indicates whether the packet forwarding has started > or not, and the number of ports which were given to the shell. > A reminder, the commit message should explain why we're doing this change, not what the change is. > This also fixes the behaviour of `wait_link_status_up` to use the > command timeout as inherited from InteractiveShell. > > Signed-off-by: Luca Vizzarro > Reviewed-by: Jack Bond-Preston > Reviewed-by: Honnappa Nagarahalli > --- > dts/framework/remote_session/testpmd_shell.py | 41 +++++++++++++------ > 1 file changed, 28 insertions(+), 13 deletions(-) > > diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framewor= k/remote_session/testpmd_shell.py > index a823dc53be..ea1d254f86 100644 > --- a/dts/framework/remote_session/testpmd_shell.py > +++ b/dts/framework/remote_session/testpmd_shell.py > @@ -678,19 +678,27 @@ def __str__(self) -> str: > return self.pci_address > > > +@dataclass(slots=3DTrue) > +class TestPmdState: > + """Session state container.""" > + > + #: > + packet_forwarding_started: bool =3D False The same question as in the previous patch, do you anticipate this being needed and should we add this only when it's actually used? > + > + #: The number of ports which were allowed on the command-line when t= estpmd was started. > + number_of_ports: int =3D 0 > + > + > class TestPmdShell(InteractiveShell): > """Testpmd interactive shell. > > The testpmd shell users should never use > the :meth:`~.interactive_shell.InteractiveShell.send_command` method= directly, but rather > call specialized methods. If there isn't one that satisfies a need, = it should be added. > - > - Attributes: > - number_of_ports: The number of ports which were allowed on the c= ommand-line when testpmd > - was started. > """ > > - number_of_ports: int > + #: Current state > + state: TestPmdState =3D TestPmdState() Assigning a value makes this a class variable, shared across all instances. This should be initialized in __init__(). But do we actually want to do this via composition? We'd need to access the attributes via .state all the time and I don't really like that. We could just put them into TestPmdShell directly, initializing them in __init__(). > > #: The path to the testpmd executable. > path: ClassVar[PurePath] =3D PurePath("app", "dpdk-testpmd")