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 F110645A12; Mon, 23 Sep 2024 20:43:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB28E4042E; Mon, 23 Sep 2024 20:42:56 +0200 (CEST) Received: from mail-oa1-f99.google.com (mail-oa1-f99.google.com [209.85.160.99]) by mails.dpdk.org (Postfix) with ESMTP id 50D00402CF for ; Mon, 23 Sep 2024 20:42:54 +0200 (CEST) Received: by mail-oa1-f99.google.com with SMTP id 586e51a60fabf-27d045a73easo2588288fac.0 for ; Mon, 23 Sep 2024 11:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1727116973; x=1727721773; 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=RyGc7HFqZOmYVJBuD1stUBtB0nkywKkqkC4cmrl6v2EgOrNH/GZKj01+E0hVj9Cnsj hQUUcLpumnwukBOpCJrPvzgH/9bHZpzzZoEXOPyJPG5xQFBwGTuXJtRwjQfonYniFrfQ +lBN7X8bosB/e3xc46D6ocyPMOY001NnRHiSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727116973; x=1727721773; 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=UiaBgrjFZNlNNc81msuitfbd8YA3wQNTnNKduPmSbcTuLhsGl1KGl9FPehoNOmA9Wj 7cbYBR6+qd5Pdbd1oom0FnkLJPx61tOZjfqsvR1gsvO8b8uw0YSrUAOw1LjoJ2cOSxzJ LGjmLpu1F8lMg8V3lJE63EjguNtLkJqgezOP8jEbzCNDVGm6I5A7T6Q7QJYZaVIZt78+ cr/88Xx44XFDCwePRjXLqHq9nQQVn/e8ol0sNnJnN6GPcmBnu5vMyW3rETs7NmEIlfZz hz8zXSm9KEAUU/KtqVjd7S9M25QRtRz01IxwEaqzrI12fWj1DgvZAeZua7oBKMRmKgbl 1Xlg== X-Gm-Message-State: AOJu0YwtKr9fY1kmGeMtP91+QxTRsTs/MQPVFSTBjx0wsw/kr9F/vqCn cyQz9Sa6CMzcwZKlRyjeArLyOmlGLa3MxpWT7O5j0tepN8KFhROHoadGZyz9Gx+y2FolQtrkf9f gX6BlMJHE1EVngz/czbMfl1oLgpalhAfQ0pF1YqQm7p3LS9gW X-Google-Smtp-Source: AGHT+IGV6UsT1ktqAEDh/fyXyRCn2Zb4ZS1oJ2ysYNzdJXaBtD4t/i9zx73mFvRtT/DYU8iOjAoaj227NuyI X-Received: by 2002:a05:6871:581f:b0:277:ce5e:1e94 with SMTP id 586e51a60fabf-2803d119450mr8008481fac.30.1727116973486; Mon, 23 Sep 2024 11:42:53 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id 586e51a60fabf-27d0b560d99sm666999fac.36.2024.09.23.11.42.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2024 11:42:53 -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 EDFA7605C352; Mon, 23 Sep 2024 14:42:51 -0400 (EDT) From: jspewock@iol.unh.edu To: npratte@iol.unh.edu, juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com, thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, alex.chapman@arm.com Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v4 3/5] dts: add class for virtual functions Date: Mon, 23 Sep 2024 14:42:33 -0400 Message-ID: <20240923184235.22582-4-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240923184235.22582-1-jspewock@iol.unh.edu> References: <20240821191557.18744-1-jspewock@iol.unh.edu> <20240923184235.22582-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