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 05A2245837; Wed, 21 Aug 2024 21:16:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DB9D42D8C; Wed, 21 Aug 2024 21:16:23 +0200 (CEST) Received: from mail-io1-f100.google.com (mail-io1-f100.google.com [209.85.166.100]) by mails.dpdk.org (Postfix) with ESMTP id 008184281D for ; Wed, 21 Aug 2024 21:16:18 +0200 (CEST) Received: by mail-io1-f100.google.com with SMTP id ca18e2360f4ac-81fd1e1d38bso385194539f.1 for ; Wed, 21 Aug 2024 12:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724267778; x=1724872578; 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=Z8zYhPZWI64RRFqa9ZLdttUYZYQ8/fRrqM6Y+FxHvgc=; b=DH1f4v3o/hv+aVeQpdIHVzRx1b1WygEyjwqAK2ZsOnak0tPAjAo1ClEm4LSXZQpyE9 nMnbAh+9YEurJjTlIoCV1CGo/wN6Ieu/GXQq/u4IlxCCPlptsqKzuEnhwJhRPw47t5na b6uk/mFiyPssLohc0xLkFahfCCxmK4hSlJvgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724267778; x=1724872578; 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=Z8zYhPZWI64RRFqa9ZLdttUYZYQ8/fRrqM6Y+FxHvgc=; b=rp5vf/JTK8tLbS2NlPw1GuMHqD1UvraHlnrBzxORoftA/YTulftWu5FChRP2/wlOLY yoMtHYQeVehxUQOe5/dQ4J1NM0s0A/zsZPjUA0gqTle+zcyciamIS54huloFL2WZvSw6 FUgfXEx3YcEaMOpZSpTDqLag2BQMKeVvhhUauV+D26KANkhXkB5ColsW+lCEEQe56npK oohFuEDmiUJXj/g16HxgR2DCB2claM40VGbon5iEkDIw1Yjwgw6skwLVPlwflbKVF2M1 jo+K34wNg3e9GMSE00RvqkhcKqeic6AuXPOq4DSbySLcuBgF3DkAi9ZXeiKbMhEWs7qB btkA== X-Gm-Message-State: AOJu0Yymwp/fKqDtkjM1RBW/K5KSgc3szTzCfG3IIbixPslncUlN6PUX FyESecZhRmN/KcVLCudhlZwsa+Olzwu8Ft/kGnT/8yLAoyTlj1+3zPlNjOqaNrKhp1geQWbMpGT 2yAKkCRKnaNdtkIw83gaMTQnmzj4ejDv+ X-Google-Smtp-Source: AGHT+IFbFySigDNYx/hm1O25ae4cQ9RHv+qMjthAqTQ/a4zxViVedLnIYO1cR9+Ut+1mtfmLcnzinp7aBOXS X-Received: by 2002:a05:6e02:1846:b0:39a:1d8d:fc9d with SMTP id e9e14a558f8ab-39d6c3ad28dmr38280975ab.22.1724267777925; Wed, 21 Aug 2024 12:16:17 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id e9e14a558f8ab-39d57945991sm2187335ab.0.2024.08.21.12.16.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Aug 2024 12:16:17 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::1083]) by postal.iol.unh.edu (Postfix) with ESMTP id D6953605C351; Wed, 21 Aug 2024 15:16:16 -0400 (EDT) From: jspewock@iol.unh.edu To: npratte@iol.unh.edu, thomas@monjalon.net, Luca.Vizzarro@arm.com, yoan.picchi@foss.arm.com, alex.chapman@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, wathsala.vithanage@arm.com, paul.szczepanek@arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, Jeremy Spewock Subject: [RFC PATCH v1 3/5] dts: add class for virtual functions Date: Wed, 21 Aug 2024 15:15:55 -0400 Message-ID: <20240821191557.18744-4-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821191557.18744-1-jspewock@iol.unh.edu> References: <20240821191557.18744-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 From: Jeremy Spewock In DPDK applications virtual functions are treated the same as ports, but within the framework there are benefits to differentiating the two in order to add more metadata to VFs about where they originate from. For this reason this patch adds a new class for handling virtual functions that extends the Port class with some additional information about the VF. Bugzilla ID: 1500 Signed-off-by: Jeremy Spewock --- dts/framework/testbed_model/port.py | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/dts/framework/testbed_model/port.py b/dts/framework/testbed_model/port.py index 817405bea4..c1d85fec2b 100644 --- a/dts/framework/testbed_model/port.py +++ b/dts/framework/testbed_model/port.py @@ -27,7 +27,7 @@ class PortIdentifier: pci: str -@dataclass(slots=True) +@dataclass class Port: """Physical port on a node. @@ -80,6 +80,41 @@ def pci(self) -> str: return self.identifier.pci +@dataclass +class VirtualFunction(Port): + """Virtual Function (VF) on a port. + + DPDK applications often treat VFs the same as they do the physical ports (PFs) on the host. + For this reason VFs are represented in the framework as a type of port with some additional + metadata that allows the framework to more easily identify which device the VF belongs to as + well as where the VF originated from. + + Attributes: + created_by_framework: :data:`True` if this VF represents one that the DTS framework created + on the node, :data:`False` otherwise. + pf_port: The PF that this VF was created on/gathered from. + """ + + created_by_framework: bool = False + pf_port: Port | None = None + + def __init__( + self, node_name: str, config: PortConfig, created_by_framework: bool, pf_port: Port + ) -> None: + """Extends :meth:`Port.__init__` with VF specific metadata. + + Args: + node_name: The name of the node the VF resides on. + config: Configuration information about the VF. + created_by_framework: :data:`True` if DTS created this VF, otherwise :data:`False` if + this class represents a VF that was preexisting on the node. + pf_port: The PF that this VF was created on/gathered from. + """ + super().__init__(node_name, config) + self.created_by_framework = created_by_framework + self.pf_port = pf_port + + @dataclass(slots=True, frozen=True) class PortLink: """The physical, cabled connection between the ports. -- 2.46.0