From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v2 1/2] eal/pci: introduce a PCI driver flag Date: Thu, 8 Jun 2017 15:40:33 +0100 Message-ID: References: <20170601130530.11443-1-jerin.jacob@caviumnetworks.com> <20170608114414.8787-1-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: thomas@monjalon.net To: Jerin Jacob , dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id AF7C6378B for ; Thu, 8 Jun 2017 16:40:36 +0200 (CEST) In-Reply-To: <20170608114414.8787-1-jerin.jacob@caviumnetworks.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 6/8/2017 12:44 PM, Jerin Jacob wrote: > Some ethdev devices like nicvf thunderx PMD need special treatment for > Secondary queue set(SQS) PCIe VF devices, where, it expects to not unmap > or free the memory without registering the ethdev subsystem. > > Introducing a new RTE_PCI_DRV_KEEP_MAPPED_RES > PCI driver flag to request PCI subsystem to not unmap the mapped PCI > resources(PCI BAR address) if unsupported device detected. > > Signed-off-by: Jerin Jacob <...> > @@ -235,6 +240,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, > static int > rte_pci_detach_dev(struct rte_pci_device *dev) > { > + int ret = 0; > struct rte_pci_addr *loc; > struct rte_pci_driver *dr; > > @@ -251,13 +257,18 @@ rte_pci_detach_dev(struct rte_pci_device *dev) > RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, > dev->id.device_id, dr->driver.name); > > - if (dr->remove && (dr->remove(dev) < 0)) > - return -1; /* negative value is an error */ > + if (dr->remove) { > + ret = dr->remove(dev); > + if (ret < 0) > + return -1; /* negative value is an error */ > + } > > /* clear driver structure */ > dev->driver = NULL; > > - if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) > + if ((dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) && > + /* Don't unmap if dev is unsupported and it needs mapped resources */ > + !(ret > 0 && (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) Why it is required to keep mapping during detach? > /* unmap resources for devices that use igb_uio */ > rte_pci_unmap_device(dev); > <...>