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 8121D433AC; Thu, 23 Nov 2023 16:15:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C98E242FC5; Thu, 23 Nov 2023 16:14:21 +0100 (CET) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mails.dpdk.org (Postfix) with ESMTP id B313442FBD for ; Thu, 23 Nov 2023 16:14:04 +0100 (CET) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50abbb23122so1190041e87.3 for ; Thu, 23 Nov 2023 07:14:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1700752444; x=1701357244; 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=kLCM/2aeBwtLd6yTf6evW5OSTnsSROs8IoIoBeLdShI=; b=jV9xFG7dlnRYRK1hy6KozxUNVp0eH4+42Z/WkDq4sMYP99KLW0l9oV3ND6bB1oiTlF Ddpqzi59mfJ0TauTIjv4uHK0TMZFN5h4FpwiRhh/vwG/nUg3+ZQWohH1eJqSlhOftdrO uaAIXOvwt4N9Lr/eBjpq5z3oo7EZo2ZzNCre2zifMwUXlFRSVw1tVbFVBoqTqtl20YkY ho3KHS7Akj8de2U4NYY6TDwXA8wlzbS5WA5QoLb8a9h488mlS/m75n9yzi3MgblEjhWz e6qcz9d2CtUp7MmjxVY9DQdyJ5F7u63OHwy9IGL7fi+OoWQI1RUrBv5HJKSZs2ps25lr wpXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700752444; x=1701357244; 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=kLCM/2aeBwtLd6yTf6evW5OSTnsSROs8IoIoBeLdShI=; b=ZhkfOvxFQ9cwrzwdTv8ugJj9uFYKiVaTyTXHwF76lBRUQ28DKvkq16wFbDo7jEZEMw KKsgNabWLveRWsfba/+PSNNN2Sv5EaNwjsPXYr56+2ehMPY6mvEQDEjgNnGGpGucgCA8 2hFzJVQGYZ/huZgqqXZsNdnJmnf5D3GtQaeDF/ZLhr3Lu9cRX5Kcv+hgjQCbungHyUih MlYeHeLfVCG+DOnuYl4AnCEioiAci1kmZT8ooHOdlarMEO4MuPpfGx5LxtlDgjUCTY6H x61iJu9pJ+91DoUAyMNwGefHZbkr/q+pxay97zLx+uAORCy8qVMjpvvMmSFucqMrNoFh 97ew== X-Gm-Message-State: AOJu0YzfMzEAv3XizJgMkeQtPqC1IAgwgXLABjnnfQDXuKD45uBsV/cd HqfmFIH5jmImukbghnVcJ4iOZsX1qSWXliVFqyS0Kg== X-Google-Smtp-Source: AGHT+IFOhXeHJMOeKqvt2X+GNut1TDDpmzcQqTeF3rnEEwefQCRsBOTZojLwcovjoG8kW3/SH70fzw== X-Received: by 2002:a05:6512:104c:b0:505:7371:ec83 with SMTP id c12-20020a056512104c00b005057371ec83mr5013439lfb.48.1700752444200; Thu, 23 Nov 2023 07:14:04 -0800 (PST) Received: from jlinkes-PT-Latitude-5530.. ([84.245.121.10]) by smtp.gmail.com with ESMTPSA id q4-20020adfea04000000b003296b488961sm1870143wrm.31.2023.11.23.07.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 07:14:03 -0800 (PST) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, Luca.Vizzarro@arm.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH v8 13/21] dts: port and virtual device docstring update Date: Thu, 23 Nov 2023 16:13:36 +0100 Message-Id: <20231123151344.162812-14-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231123151344.162812-1-juraj.linkes@pantheon.tech> References: <20231115130959.39420-1-juraj.linkes@pantheon.tech> <20231123151344.162812-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Format according to the Google format and PEP257, with slight deviations. Signed-off-by: Juraj Linkeš --- dts/framework/testbed_model/__init__.py | 17 ++++-- dts/framework/testbed_model/port.py | 53 +++++++++++++++---- dts/framework/testbed_model/virtual_device.py | 17 +++++- 3 files changed, 72 insertions(+), 15 deletions(-) diff --git a/dts/framework/testbed_model/__init__.py b/dts/framework/testbed_model/__init__.py index 8ced05653b..6086512ca2 100644 --- a/dts/framework/testbed_model/__init__.py +++ b/dts/framework/testbed_model/__init__.py @@ -2,9 +2,20 @@ # Copyright(c) 2022-2023 University of New Hampshire # Copyright(c) 2023 PANTHEON.tech s.r.o. -""" -This package contains the classes used to model the physical traffic generator, -system under test and any other components that need to be interacted with. +"""Testbed modelling. + +This package defines the testbed elements DTS works with: + + * A system under test node: :class:`~.sut_node.SutNode`, + * A traffic generator node: :class:`~.tg_node.TGNode`, + * The ports of network interface cards (NICs) present on nodes: :class:`~.port.Port`, + * The logical cores of CPUs present on nodes: :class:`~.cpu.LogicalCore`, + * The virtual devices that can be created on nodes: :class:`~.virtual_device.VirtualDevice`, + * The operating systems running on nodes: :class:`~.linux_session.LinuxSession` + and :class:`~.posix_session.PosixSession`. + +DTS needs to be able to connect to nodes and understand some of the hardware present on these nodes +to properly build and test DPDK. """ # pylama:ignore=W0611 diff --git a/dts/framework/testbed_model/port.py b/dts/framework/testbed_model/port.py index 680c29bfe3..817405bea4 100644 --- a/dts/framework/testbed_model/port.py +++ b/dts/framework/testbed_model/port.py @@ -2,6 +2,13 @@ # Copyright(c) 2022 University of New Hampshire # Copyright(c) 2023 PANTHEON.tech s.r.o. +"""NIC port model. + +Basic port information, such as location (the port are identified by their PCI address on a node), +drivers and address. +""" + + from dataclasses import dataclass from framework.config import PortConfig @@ -9,24 +16,35 @@ @dataclass(slots=True, frozen=True) class PortIdentifier: + """The port identifier. + + Attributes: + node: The node where the port resides. + pci: The PCI address of the port on `node`. + """ + node: str pci: str @dataclass(slots=True) class Port: - """ - identifier: The PCI address of the port on a node. - - os_driver: The driver used by this port when the OS is controlling it. - Example: i40e - os_driver_for_dpdk: The driver the device must be bound to for DPDK to use it, - Example: vfio-pci. + """Physical port on a node. - Note: os_driver and os_driver_for_dpdk may be the same thing. - Example: mlx5_core + The ports are identified by the node they're on and their PCI addresses. The port on the other + side of the connection is also captured here. + Each port is serviced by a driver, which may be different for the operating system (`os_driver`) + and for DPDK (`os_driver_for_dpdk`). For some devices, they are the same, e.g.: ``mlx5_core``. - peer: The identifier of a port this port is connected with. + Attributes: + identifier: The PCI address of the port on a node. + os_driver: The operating system driver name when the operating system controls the port, + e.g.: ``i40e``. + os_driver_for_dpdk: The operating system driver name for use with DPDK, e.g.: ``vfio-pci``. + peer: The identifier of a port this port is connected with. + The `peer` is on a different node. + mac_address: The MAC address of the port. + logical_name: The logical name of the port. Must be discovered. """ identifier: PortIdentifier @@ -37,6 +55,12 @@ class Port: logical_name: str = "" def __init__(self, node_name: str, config: PortConfig): + """Initialize the port from `node_name` and `config`. + + Args: + node_name: The name of the port's node. + config: The test run configuration of the port. + """ self.identifier = PortIdentifier( node=node_name, pci=config.pci, @@ -47,14 +71,23 @@ def __init__(self, node_name: str, config: PortConfig): @property def node(self) -> str: + """The node where the port resides.""" return self.identifier.node @property def pci(self) -> str: + """The PCI address of the port.""" return self.identifier.pci @dataclass(slots=True, frozen=True) class PortLink: + """The physical, cabled connection between the ports. + + Attributes: + sut_port: The port on the SUT node connected to `tg_port`. + tg_port: The port on the TG node connected to `sut_port`. + """ + sut_port: Port tg_port: Port diff --git a/dts/framework/testbed_model/virtual_device.py b/dts/framework/testbed_model/virtual_device.py index eb664d9f17..e9b5e9c3be 100644 --- a/dts/framework/testbed_model/virtual_device.py +++ b/dts/framework/testbed_model/virtual_device.py @@ -1,16 +1,29 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2023 PANTHEON.tech s.r.o. +"""Virtual devices model. + +Alongside support for physical hardware, DPDK can create various virtual devices. +""" + class VirtualDevice(object): - """ - Base class for virtual devices used by DPDK. + """Base class for virtual devices used by DPDK. + + Attributes: + name: The name of the virtual device. """ name: str def __init__(self, name: str): + """Initialize the virtual device. + + Args: + name: The name of the virtual device. + """ self.name = name def __str__(self) -> str: + """This corresponds to the name used for DPDK devices.""" return self.name -- 2.34.1