From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id ACD833B5 for ; Thu, 27 Oct 2016 15:28:24 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id e69so34919001wmg.0 for ; Thu, 27 Oct 2016 06:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aPea4BHBLkpDCgq8yPGyH06x+M3AHvCxFoEXvA4j1H8=; b=XcfNq/9+ybYKLulfvddPQx/QfWZGEFC0BV0PIDhIFL/4E1ZMRHeBLd5PfNykXNJ1kf 9huY3uQsfx/vcPExkT1E0n7R6oAQQy+T3DiBCgoGHFnNgQIpZM2oLKGG6JHgLW5Dw8fL ZLqCgNVWw4ROmKcstg4hwB/6TR8vDZHcXvTZf213e4UFCq+5KxKhC0snl8SwH+Tx61Ci sFwnlXvsXf/n5NEworwGQlpeoTKM8YXKuUFbdBZua/wVCzwhlH5RxADUcIpm7QrZvyvC 6IRwixcHMKRSsWPm5Sv13muTLS0ieGfV2ZxvoZ38XnEgRzPUkqqlT9N7KDeafQUSWnoE bq4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aPea4BHBLkpDCgq8yPGyH06x+M3AHvCxFoEXvA4j1H8=; b=HQGHWvDLizoyHsAhebWo2Dz1E4PbZZnnK91hJ+n47Xa3Kf9yM7CK23W4Ryr29TWL/m 7ywhPiJ0v1DEocwq/Z0z6AkhXrnY7ZDh2mAVBtozeO1uy5j13aXgzkTf5e4NdJ/jvW7i DWNFFfa2YK/rihHvaVD4PN/m3hUDwaHcYMCz20qcIwSGN3Wed7J1TnFg6HECw6hPqaGz slIf00D/EtNQU+LLjfWGl5n7pIIrJmPydE+6cEWnIqSyCSRMvjdFogLJl95FZ/pd6U+X LTcXEeg4Yc29sWtbcF6YQ6YogGB8preB9vE4pHw7xBppXtJ2aL81OPoUWaNxTiB2qV9e 1g2A== X-Gm-Message-State: ABUngvcw+E5+zbR8uUppX8Bmbyds+XvxGV69oV/FVIQYWrp2pE2nmro1v3CwJf33lEmjjmeqtjt3m7/6DqbtXQF1 X-Received: by 10.28.175.77 with SMTP id y74mr13124807wme.114.1477574904385; Thu, 27 Oct 2016 06:28:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.38.67 with HTTP; Thu, 27 Oct 2016 06:28:03 -0700 (PDT) In-Reply-To: <1477432240-20406-1-git-send-email-benjamin.walker@intel.com> References: <1477432240-20406-1-git-send-email-benjamin.walker@intel.com> From: David Marchand Date: Thu, 27 Oct 2016 15:28:03 +0200 Message-ID: To: Ben Walker Content-Type: text/plain; charset=UTF-8 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] pci: Don't call probe callback if driver already loaded. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 13:28:24 -0000 Hello Benjamin, On Tue, Oct 25, 2016 at 11:50 PM, 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. Why not use the hotplug api, attaching explicitely one pci device ? > 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; > + This can do the trick, yes. To be safe, I think we are missing a check in rte_eal_pci_probe_one_driver() so that dev->driver is only set when the probe function from the driver did succeed. -- David Marchand