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 EDCD545D07; Thu, 14 Nov 2024 18:36:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD7364025D; Thu, 14 Nov 2024 18:36:06 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id D67FE4021F for ; Thu, 14 Nov 2024 18:36:04 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 013F71474; Thu, 14 Nov 2024 09:36:34 -0800 (PST) Received: from [10.1.39.61] (JR4XG4HTQC.cambridge.arm.com [10.1.39.61]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 274303F6A8; Thu, 14 Nov 2024 09:36:02 -0800 (PST) Message-ID: Date: Thu, 14 Nov 2024 17:36:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 5/5] dts: add functions for managing VFs to Node Content-Language: en-GB To: jspewock@iol.unh.edu, 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, alex.chapman@arm.com Cc: dev@dpdk.org References: <20240821191557.18744-1-jspewock@iol.unh.edu> <20240923184235.22582-1-jspewock@iol.unh.edu> <20240923184235.22582-6-jspewock@iol.unh.edu> From: Luca Vizzarro In-Reply-To: <20240923184235.22582-6-jspewock@iol.unh.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 23/09/2024 19:42, jspewock@iol.unh.edu wrote: > + > + def get_vfs_on_port(self, pf_port: Port) -> list[VirtualFunction]: > + """Get all virtual functions (VFs) that DTS is aware of on `pf_port`. > + > + Args: > + pf_port: The port to search for the VFs on. > + > + Returns: > + A list of VFs in the framework that were created/gathered from `pf_port`. > + """ > + return [p for p in self.ports if isinstance(p, VirtualFunction) and p.pf_port == pf_port] If the change proposed by Juraj to store VFs under the PF goes through, this could end up being simpler. > + > + def remove_virtual_functions(self, pf_port: Port) -> None: > + """Removes all virtual functions (VFs) created on `pf_port` by DTS. > + > + Finds all the VFs that were created from `pf_port` and either removes them if they were > + created by the DTS framework or binds them back to their os_driver if they were preexisting > + on the node. > + > + Args: > + pf_port: Port to remove the VFs from. > + """ > + vf_ports = self.get_vfs_on_port(pf_port) > + if any(vf.created_by_framework for vf in vf_ports): > + self.main_session.set_num_virtual_functions(0, pf_port) > + else: > + self._logger.info("Skipping removing VFs since they were not created by DTS.") This will cause VFs that were created by us to not be removed. We should ensure at least these ones are cleaned up.