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 ED69545837; Wed, 21 Aug 2024 21:22:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9516442DB0; Wed, 21 Aug 2024 21:22:29 +0200 (CEST) Received: from mail-ot1-f99.google.com (mail-ot1-f99.google.com [209.85.210.99]) by mails.dpdk.org (Postfix) with ESMTP id 4D3AA427BD for ; Wed, 21 Aug 2024 21:22:27 +0200 (CEST) Received: by mail-ot1-f99.google.com with SMTP id 46e09a7af769-70941cb73e9so46586a34.2 for ; Wed, 21 Aug 2024 12:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724268146; x=1724872946; 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=NqLF5CCEaVVkgLV2cpH/aLf5p0+xIKACogIza3OFcsj+JKfY9j3DC3c6AiEVibHXSX EVDNj9OxMYBvpqdYUaVPTroOWFDlxbow80+OhX7wdSB6nw7j/jRp5SRvzb84GZd39/uN 0NkOTarakcDI6JpAR0Ea+r91N3072II8kled4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724268146; x=1724872946; 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=dLOjgBmPCntrAsh1pg65sWSBwQ9J59JZ9Dq/b03pTpx7eRqlHKDd124qWioLa9HW8O AvXF39E5HYtAGhXlzRLAcY+6lRgv3MtKeqmo7AJtnOaP37TWVEOM9BauH3VKUeICKCjp ip7hnNa0S5hLWB/hApKTwULvgMszBp06fAhZsX3Cox0uGlOU6TvZxy9Q8W1tSDAuO2gx R0NWqBAQGH6gc0gK0oJbvsZTlGkbmkNEIqc6Ck/29OEwP1YEi0xvkekytTcDQpwnARON 5L3ZzDxVjjMg9MgwTo3apLDm8n2Kdv1gB48iugakt9/8NQgCPmPzH36KgSAtT+Uej1YO BGpw== X-Gm-Message-State: AOJu0YxBOakgTPZLu1lGADxaaEfxDhzo/3HXJFYaPHZyacQ0dgmMHBsZ mXWUzZ4HUvj5yjViu/ZIbWE+VE14bBtXkJJDcsEBtxw8me9jYQHTdYqPWlEMqVFiQ6jbYaXka4J b/ixfkfWZqo9O4lSiv1/oRye2CmNFKsGR9AUfI1YUUv6pIDfR X-Google-Smtp-Source: AGHT+IG/PimbCXoA6ubKtdracqZjvdwGLWRwcl4YhDWXVEGfnwSCe+mwSyFcN6whb09M0Idl99kFPGtA4heC X-Received: by 2002:a05:6830:641c:b0:709:4757:973 with SMTP id 46e09a7af769-70df8871661mr3998967a34.23.1724268146376; Wed, 21 Aug 2024 12:22:26 -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 46e09a7af769-70ca618b51fsm428114a34.0.2024.08.21.12.22.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Aug 2024 12:22:26 -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 44EFF605C351; Wed, 21 Aug 2024 15:22:25 -0400 (EDT) From: jspewock@iol.unh.edu To: wathsala.vithanage@arm.com, npratte@iol.unh.edu, thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, Luca.Vizzarro@arm.com, probb@iol.unh.edu, yoan.picchi@foss.arm.com, alex.chapman@arm.com, juraj.linkes@pantheon.tech, paul.szczepanek@arm.com Cc: dev@dpdk.org, Jeremy Spewock Subject: [RFC PATCH v2 3/5] dts: add class for virtual functions Date: Wed, 21 Aug 2024 15:21:50 -0400 Message-ID: <20240821192151.20874-5-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