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 83909432BB; Mon, 6 Nov 2023 18:18:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54BB742D0B; Mon, 6 Nov 2023 18:16:26 +0100 (CET) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by mails.dpdk.org (Postfix) with ESMTP id 31003427D9 for ; Mon, 6 Nov 2023 18:16:23 +0100 (CET) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-9ae2cc4d17eso733056466b.1 for ; Mon, 06 Nov 2023 09:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1699290983; x=1699895783; 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=nNWqU1DLwXxy+jHTYIQUWcQVb4gb9gLJSwll5Z93zLQ=; b=l+m4xufIg9QZumWu0MQAxvqQFPPmV6y3dxqZ1Kg243i5btMMDjg4AorImsYGnZ0Z8Y WgU0Fst121eomjL+LH1DrUh9uGpNlVkh/q2QaYTR/JkZ4wvF8o0TNvHvVeXIbAREvRxG KpRY922lRwmpEwxQGmBPO9wfpCXcdUykxYllcrgbqCEYJQYKTE57ccylOIPaqxRM6nrS MlyTa1WQwQaFBAoL461cJjtROHv8sNGOlh14zenMQiO3viXs0wgpA4eq2qgkoK2wLUxb mvLcxCOM5LAarAiqbH7i/PrglMojX3kBFRv/KxotGqZ78GhA+EYAdYOxhosAkMXztoZE PBxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699290983; x=1699895783; 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=nNWqU1DLwXxy+jHTYIQUWcQVb4gb9gLJSwll5Z93zLQ=; b=UoPQFZYN7V/Gd+TmaBMoE3kwjZckYnZR/Ra3V02TvREfdN6cP9kqexPKX7o/Sh1+vQ O/8AFywp1OOOxqrfXfMyIsaso7lO2sM7yLThqLNWHH2a4q2sciDNeWP4bPWWelXWeu5L Wv3yjZng1kYJKcKDuuzcKDmRlbiy1KuYjsopMlaDzfwSW2A4N3SC3FqqtfZ4+avwqG1B TSjaj86ZJ3xeFmZAe32Ra/PVPPPDaUDoraIQ8LMNe9UrUIYmQK/q0QQs4raE/b44RT2c r0duap6Vgn+D4t+QeSdABK4tGcKlN3fxXnlZbfGnha3RXXAErPeN8t/GLr+8Sf8WzS5z zNmg== X-Gm-Message-State: AOJu0YwP5fRM1nTMK/kzm8OK/rCwyvuw0PNokPm+pB4q+CzUDlNHr+9H 8nqlyWjMrCaBLFcEd1B0BmUlaFzVTJoOFl4cimageg== X-Google-Smtp-Source: AGHT+IGmfM1NYWGlKgsBxKwZHJ2LkG9PMMFznx4zkUGnySk+l8TDIqZbK+IuZF3DQzY2jm1gzDDioQ== X-Received: by 2002:a17:907:806:b0:9b2:b269:d563 with SMTP id wv6-20020a170907080600b009b2b269d563mr15667681ejb.63.1699290982911; Mon, 06 Nov 2023 09:16:22 -0800 (PST) Received: from jlinkes-PT-Latitude-5530.. (ip-46.34.243.197.o2inet.sk. [46.34.243.197]) by smtp.gmail.com with ESMTPSA id s10-20020a170906354a00b009b947aacb4bsm47016eja.191.2023.11.06.09.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 09:16:22 -0800 (PST) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH v5 13/23] dts: port and virtual device docstring update Date: Mon, 6 Nov 2023 18:15:51 +0100 Message-Id: <20231106171601.160749-14-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106171601.160749-1-juraj.linkes@pantheon.tech> References: <20230831100407.59865-1-juraj.linkes@pantheon.tech> <20231106171601.160749-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 | 16 ++++-- dts/framework/testbed_model/port.py | 53 +++++++++++++++---- dts/framework/testbed_model/virtual_device.py | 17 +++++- 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/dts/framework/testbed_model/__init__.py b/dts/framework/testbed_model/__init__.py index 8ced05653b..a02be1f2d9 100644 --- a/dts/framework/testbed_model/__init__.py +++ b/dts/framework/testbed_model/__init__.py @@ -2,9 +2,19 @@ # 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:`SutNode`, + * A traffic generator node: :class:`TGNode`, + * The ports of network interface cards (NICs) present on nodes: :class:`Port`, + * The logical cores of CPUs present on nodes: :class:`LogicalCore`, + * The virtual devices that can be created on nodes: :class:`VirtualDevice`, + * The operating systems running on nodes: :class:`LinuxSession` and :class:`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