From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: Re: [PATCH] pci: Don't call probe callback if driver already loaded. Date: Wed, 2 Nov 2016 14:59:27 +0530 Message-ID: <07a79e86-fadc-a702-28be-883f0b736964@nxp.com> References: <1477432240-20406-1-git-send-email-benjamin.walker@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Ben Walker Return-path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0049.outbound.protection.outlook.com [104.47.36.49]) by dpdk.org (Postfix) with ESMTP id A44F11E29 for ; Wed, 2 Nov 2016 10:29:40 +0100 (CET) In-Reply-To: <1477432240-20406-1-git-send-email-benjamin.walker@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/26/2016 3:20 AM, Ben Walker wrote: > If the user asks to probe multiple times, the probe > callback should only be called on devices that don't have > a driver already loaded. > > This is useful if a driver is registered after the > execution of a program has started and the list of devices > needs to be re-scanned. > > Signed-off-by: Ben Walker > --- > lib/librte_eal/common/eal_common_pci.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c > index 638cd86..971ad20 100644 > --- a/lib/librte_eal/common/eal_common_pci.c > +++ b/lib/librte_eal/common/eal_common_pci.c > @@ -289,6 +289,10 @@ pci_probe_all_drivers(struct rte_pci_device *dev) > if (dev == NULL) > return -1; > > + /* Check if a driver is already loaded */ > + if (dev->driver != NULL) > + return 0; > + In case if it is required to change the driver assigned to a device, would it mean application relies on detach(dev)->new-driver-plugged-in->attach(dev) sequence? To me, the above change sounds fine. Though, I am not aware if there is even a use case for changing driver assigned to a device. detach()->attach() should be able to work in those cases, I think. > TAILQ_FOREACH(dr, &pci_driver_list, next) { > rc = rte_eal_pci_probe_one_driver(dr, dev); > if (rc < 0) > - Shreyansh