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 1B0E5440EC; Tue, 28 May 2024 17:45:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC39E402E8; Tue, 28 May 2024 17:45:00 +0200 (CEST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by mails.dpdk.org (Postfix) with ESMTP id 29C73402E4 for ; Tue, 28 May 2024 17:44:59 +0200 (CEST) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2e95a1ddc17so808501fa.0 for ; Tue, 28 May 2024 08:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1716911098; x=1717515898; 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=sE/Zmg9poR2HNoyCc4e4/mQRatT88Gw5OiMd+OLihWA=; b=UKVq5ceHp8wqEpEjEYNinUcHqCULSvuDgMSGoG41fwmaZ5TObBPWMz7/t0YEFpb/ph 7308k4rHqzGbp9Lwy7UWSNcpFZk6cfWgeq8V1gzVS/jCl9rM3r521BicOumPh1qtQHJ1 Plo8Ri118adO3RcSCUnUhIbXs8dIgngQ2etm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716911098; x=1717515898; 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=sE/Zmg9poR2HNoyCc4e4/mQRatT88Gw5OiMd+OLihWA=; b=L7f5k+D1A5ys8z1nf5iylRt0ClgN3Tvdoyj90OnuOLK5mGID3sKYs8gWEEH/83sSS7 ar/jPAKkWpVraWef7bhTyAE1VdzpZF6k7Ng+Vc7bmgYxqyMihJPgdWQjQT9oNOT/11u0 hnbPnDKUO1WFmI7inacy1RpFel6rSy0d7NsNHe6+pltU9Rrw7l06iO02p03n/M637C6h ud7vfglFZDdB6p5NKIjS4o2bxdiHNv8/4+Inl71MVqjqrnt8z+6BacKtI2UXp+c9WhBD qWE9u86c4yASWCcPp57j9GxVIf+JbICkOsjEgJL24rnhaCU4OL9RvU/VZD7x44EUlUtv WvEw== X-Gm-Message-State: AOJu0YwPCo2KV3g6np+mziQNvwL2gRBWuMR3Pt77bA/dKLTEjFqwROKx L+8t5fhfsy3oUn6hBz4nqztM2CViYui0DExnmbxnG7Jglqfe5sg0vT92oXK1srUVsflFo+jd5Oe SuBpcsf0U0ivXfYEJLhdYgwxgI0PzoEwzmj8B+A== X-Google-Smtp-Source: AGHT+IGyUugqBVmf/e8vXDv33rrCy8NOXS8Keq4q+Dfs1ovMF2UITmdGVtuWipmuTHz8F30Tka64CqdgdVg2WgdPz1w= X-Received: by 2002:a2e:8516:0:b0:2df:4bad:cb7f with SMTP id 38308e7fff4ca-2e95b1cc410mr74627831fa.2.1716911098166; Tue, 28 May 2024 08:44:58 -0700 (PDT) MIME-Version: 1.0 References: <20240326190422.577028-1-luca.vizzarro@arm.com> <20240509112057.1167947-1-luca.vizzarro@arm.com> <20240509112057.1167947-4-luca.vizzarro@arm.com> In-Reply-To: <20240509112057.1167947-4-luca.vizzarro@arm.com> From: Nicholas Pratte Date: Tue, 28 May 2024 11:44:47 -0400 Message-ID: Subject: Re: [PATCH v2 3/8] dts: refactor EalParams To: Luca Vizzarro Cc: dev@dpdk.org, =?UTF-8?Q?Juraj_Linke=C5=A1?= , Jeremy Spewock , Paul Szczepanek 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 Tested-by: Nicholas Pratte Reviewed-by: Nicholas Pratte On Thu, May 9, 2024 at 7:21=E2=80=AFAM Luca Vizzarro wrote: > > Move EalParams to its own module to avoid circular dependencies. > > Signed-off-by: Luca Vizzarro > Reviewed-by: Paul Szczepanek > --- > dts/framework/params/eal.py | 50 +++++++++++++++++++ > dts/framework/remote_session/testpmd_shell.py | 2 +- > dts/framework/testbed_model/sut_node.py | 42 +--------------- > 3 files changed, 53 insertions(+), 41 deletions(-) > create mode 100644 dts/framework/params/eal.py > > diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py > new file mode 100644 > index 0000000000..bbdbc8f334 > --- /dev/null > +++ b/dts/framework/params/eal.py > @@ -0,0 +1,50 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2024 Arm Limited > + > +"""Module representing the DPDK EAL-related parameters.""" > + > +from dataclasses import dataclass, field > +from typing import Literal > + > +from framework.params import Params, Switch > +from framework.testbed_model.cpu import LogicalCoreList > +from framework.testbed_model.port import Port > +from framework.testbed_model.virtual_device import VirtualDevice > + > + > +def _port_to_pci(port: Port) -> str: > + return port.pci > + > + > +@dataclass(kw_only=3DTrue) > +class EalParams(Params): > + """The environment abstraction layer parameters. > + > + Attributes: > + lcore_list: The list of logical cores to use. > + memory_channels: The number of memory channels to use. > + prefix: Set the file prefix string with which to start DPDK, e.g= .: ``prefix=3D"vf"``. > + no_pci: Switch to disable PCI bus, e.g.: ``no_pci=3DTrue``. > + vdevs: Virtual devices, e.g.:: > + vdevs=3D[ > + VirtualDevice('net_ring0'), > + VirtualDevice('net_ring1') > + ] > + ports: The list of ports to allow. > + other_eal_param: user defined DPDK EAL parameters, e.g.: > + ``other_eal_param=3D'--single-file-segments'`` > + """ > + > + lcore_list: LogicalCoreList =3D field(metadata=3DParams.short("l")) > + memory_channels: int =3D field(metadata=3DParams.short("n")) > + prefix: str =3D field(metadata=3DParams.long("file-prefix")) > + no_pci: Switch =3D None > + vdevs: list[VirtualDevice] | None =3D field( > + default=3DNone, metadata=3DParams.multiple() | Params.long("vdev= ") > + ) > + ports: list[Port] | None =3D field( > + default=3DNone, > + metadata=3DParams.convert_value(_port_to_pci) | Params.multiple(= ) | Params.short("a"), > + ) > + other_eal_param: Params | None =3D None > + _separator: Literal[True] =3D field(default=3DTrue, init=3DFalse, me= tadata=3DParams.short("-")) > diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framewor= k/remote_session/testpmd_shell.py > index 7eced27096..841d456a2f 100644 > --- a/dts/framework/remote_session/testpmd_shell.py > +++ b/dts/framework/remote_session/testpmd_shell.py > @@ -21,8 +21,8 @@ > from typing import Callable, ClassVar > > from framework.exception import InteractiveCommandExecutionError > +from framework.params.eal import EalParams > from framework.settings import SETTINGS > -from framework.testbed_model.sut_node import EalParams > from framework.utils import StrEnum > > from .interactive_shell import InteractiveShell > diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/test= bed_model/sut_node.py > index c886590979..e1163106a3 100644 > --- a/dts/framework/testbed_model/sut_node.py > +++ b/dts/framework/testbed_model/sut_node.py > @@ -15,9 +15,8 @@ > import os > import tarfile > import time > -from dataclasses import dataclass, field > from pathlib import PurePath > -from typing import Literal, Type > +from typing import Type > > from framework.config import ( > BuildTargetConfiguration, > @@ -26,6 +25,7 @@ > SutNodeConfiguration, > ) > from framework.params import Params, Switch > +from framework.params.eal import EalParams > from framework.remote_session import CommandResult > from framework.settings import SETTINGS > from framework.utils import MesonArgs > @@ -37,44 +37,6 @@ > from .virtual_device import VirtualDevice > > > -def _port_to_pci(port: Port) -> str: > - return port.pci > - > - > -@dataclass(kw_only=3DTrue) > -class EalParams(Params): > - """The environment abstraction layer parameters. > - > - Attributes: > - lcore_list: The list of logical cores to use. > - memory_channels: The number of memory channels to use. > - prefix: Set the file prefix string with which to start DPDK, e.g= .: ``prefix=3D"vf"``. > - no_pci: Switch to disable PCI bus, e.g.: ``no_pci=3DTrue``. > - vdevs: Virtual devices, e.g.:: > - vdevs=3D[ > - VirtualDevice('net_ring0'), > - VirtualDevice('net_ring1') > - ] > - ports: The list of ports to allow. > - other_eal_param: user defined DPDK EAL parameters, e.g.: > - ``other_eal_param=3D'--single-file-segments'`` > - """ > - > - lcore_list: LogicalCoreList =3D field(metadata=3DParams.short("l")) > - memory_channels: int =3D field(metadata=3DParams.short("n")) > - prefix: str =3D field(metadata=3DParams.long("file-prefix")) > - no_pci: Switch > - vdevs: list[VirtualDevice] | None =3D field( > - default=3DNone, metadata=3DParams.multiple() | Params.long("vdev= ") > - ) > - ports: list[Port] | None =3D field( > - default=3DNone, > - metadata=3DParams.convert_value(_port_to_pci) | Params.multiple(= ) | Params.short("a"), > - ) > - other_eal_param: Params | None =3D None > - _separator: Literal[True] =3D field(default=3DTrue, init=3DFalse, me= tadata=3DParams.short("-")) > - > - > class SutNode(Node): > """The system under test node. > > -- > 2.34.1 >