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 BBAE945482; Mon, 17 Jun 2024 17:23:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A970B40A77; Mon, 17 Jun 2024 17:23:37 +0200 (CEST) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by mails.dpdk.org (Postfix) with ESMTP id BB05940A67 for ; Mon, 17 Jun 2024 17:23:36 +0200 (CEST) Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2ebdcb0e07dso4228791fa.2 for ; Mon, 17 Jun 2024 08:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718637816; x=1719242616; 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=H5eTpGoN7lfEzxj2rJMrEUFBCUrD1GVL8VlSsrl59aU=; b=GH4D7wzBbhcd2jQhEKi43O1w9ZSB1JVx741kix6cFS+YzlBnUh7H6iGSjITd6lb+co 7bEO2kH77Ku8cW9wl85OM0WtOENXmVF/xm+/RFXwzNpMWOOFHgnm71xZXfRIG9tSKprW CK84S/MzY6Smy4E0oEgTabjLdPMtepolkhehE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718637816; x=1719242616; 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=H5eTpGoN7lfEzxj2rJMrEUFBCUrD1GVL8VlSsrl59aU=; b=RO7CGvP13VSK+/rgN8B7l6mzZr55aqqm+P8lFfCOWGrEGMK9Ys1rloy0e8Nc+9n4Ex eyGjuc4LV/egqJGSCZjOeazzN/GXH0nfvKl2iH7n8tUjRyJhQ2wdiHN178Lxz1ma4wLB yuB7XJi0oS7XKkTB0zKq4GhyOGSa8dPwcvtb4CzThUZY6I6j4EbiNs89b6DhDEwVXfvf Gvt+9V+GSodSjfIJNB//iAsKi1SgM3xMhYuCv0U7wZXMfEyrpUFiu7reC2HduAwuhfFB 4lSqB7XoO62G1ftC5GsW8PABM3ldf9ktCWxR2RMUIl4VaKIyLT7UCXx4lTo1uzxO1bGS M0Bw== X-Gm-Message-State: AOJu0Yy9gf9+ilwQgrF31dIeEyXSne/fnzTcFgA/2ZSOwACkF1jtTN4u qwvfLqdQZpiEOfmXYDRgV2z9nasgdVF4aeEUOGR2B59unmbmf9d/my27ZTSSx590xoHAMN2slQb NFAoUEkWT0ONwucg2wyQy5JgXQrcqBymOaniT6Q== X-Google-Smtp-Source: AGHT+IGMfoOMckmgWWy/JRQrq4EmERDY1L+/85Va/QemqKIR0orsCnIAqCULGM53mmX9hiVYC5QMzYi4lRGmW6osVeU= X-Received: by 2002:a05:651c:2206:b0:2eb:d5f1:d8b1 with SMTP id 38308e7fff4ca-2ec0e5c8904mr66487641fa.3.1718637816230; Mon, 17 Jun 2024 08:23:36 -0700 (PDT) MIME-Version: 1.0 References: <20240326190422.577028-1-luca.vizzarro@arm.com> <20240617145409.67407-1-luca.vizzarro@arm.com> <20240617145409.67407-4-luca.vizzarro@arm.com> In-Reply-To: <20240617145409.67407-4-luca.vizzarro@arm.com> From: Nicholas Pratte Date: Mon, 17 Jun 2024 11:23:25 -0400 Message-ID: Subject: Re: [PATCH v5 3/8] dts: refactor EalParams To: Luca Vizzarro Cc: dev@dpdk.org, Jeremy Spewock , =?UTF-8?Q?Juraj_Linke=C5=A1?= , 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 Mon, Jun 17, 2024 at 10:54=E2=80=AFAM Luca Vizzarro wrote: > > Move EalParams to its own module to avoid circular dependencies. > Also the majority of the attributes are now optional. > > Signed-off-by: Luca Vizzarro > Reviewed-by: Paul Szczepanek > Reviewed-by: Juraj Linke=C5=A1 > Reviewed-by: Jeremy Spewock > Reviewed-by: Nicholas Pratte > --- > 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 2836ed5c48..2b9ef9418d 100644 > --- a/dts/framework/remote_session/testpmd_shell.py > +++ b/dts/framework/remote_session/testpmd_shell.py > @@ -26,9 +26,9 @@ > from typing_extensions import Self > > from framework.exception import InteractiveCommandExecutionError > +from framework.params.eal import EalParams > from framework.parser import ParserFn, TextParser > 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 >