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 DA37945837; Wed, 21 Aug 2024 21:39:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D274B42DD3; Wed, 21 Aug 2024 21:39:55 +0200 (CEST) Received: from mail-pf1-f227.google.com (mail-pf1-f227.google.com [209.85.210.227]) by mails.dpdk.org (Postfix) with ESMTP id 9FA3D42DD3 for ; Wed, 21 Aug 2024 21:39:54 +0200 (CEST) Received: by mail-pf1-f227.google.com with SMTP id d2e1a72fcca58-7142448aaf9so27484b3a.1 for ; Wed, 21 Aug 2024 12:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724269194; x=1724873994; 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=NTYGKPM9zH4Sr/FCm3a9myawEq0g6/q/ZxHhjePU5QRXmgKY7lpq3D2rm0SmroROB9 MoH4UB8A+mT9+VGZr8UgzBrfF2YIoVan44YMiNluCAUlg9lcmJOPC2flQrVUDLlWOP87 MWLqBfe2RodweEARG7kvLjmlLusoH33X6vw5Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724269194; x=1724873994; 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=Eip0Jainkx0f0OXn2pTbsHszga3DCf8nBQrgqfpHv9zmiAeau7cjKsLmfAVebvJFip Dz5D2GvHzM4XNSZgP2c298m84//tD8eyEDywA0eg/2pG3THMK4O6Vj8m5UHkcjwBSDx7 AgJmHwwitId4esaMSRzHzfBqwAcjBLFguk0epEHOf1YD0rRkcIJ2wpAbKYX4qjtY4ZVA 7uSn0TCMvJkcXTw5WHiNlP5qycqeQWOXVbUrTCXmotgfetgGv0UEOndeUXJsKxSDZPIs CJdeCo2WzJIdC1ipCZxUqoW/G0+TRtL1g88O/udRxiv52f0c98vlRYRuFL6/1Qym0OMC 1ZdA== X-Gm-Message-State: AOJu0YyTpt2kcSUYYwz6EXYh2icKbzm0lvkNnuHOUqt1ZO7RMpq+t77M fcploPtJNzX/EZ/mFloSwvpSdnpWEPr4/TiKcS09j0fO//zoVldC77j5GkQD6zAU6RdHt/pSpH8 70xlHdQFCJL5H33gyUfTM5ew2Zfs/S/0irinzFjCQB0z/3KME X-Google-Smtp-Source: AGHT+IGsmiLML6AEOKu9sNRJIxev9BE8opVeez6r4C0e7yhcSj6KNZ9UCb02eVPhD5Hse1rkfNqR+qgRpj44 X-Received: by 2002:a05:6a00:3c86:b0:70e:aa7f:2cb3 with SMTP id d2e1a72fcca58-71431712adamr981793b3a.2.1724269193752; Wed, 21 Aug 2024 12:39: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 d2e1a72fcca58-71434234e58sm1529b3a.1.2024.08.21.12.39.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Aug 2024 12:39: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 60BFC605C351; Wed, 21 Aug 2024 15:39:52 -0400 (EDT) From: jspewock@iol.unh.edu To: npratte@iol.unh.edu, paul.szczepanek@arm.com, thomas@monjalon.net, probb@iol.unh.edu, yoan.picchi@foss.arm.com, juraj.linkes@pantheon.tech, wathsala.vithanage@arm.com, Luca.Vizzarro@arm.com, alex.chapman@arm.com, Honnappa.Nagarahalli@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:38:39 -0400 Message-ID: <20240821193841.21033-4-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821193841.21033-1-jspewock@iol.unh.edu> References: <20240821191557.18744-1-jspewock@iol.unh.edu> <20240821193841.21033-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