DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: Ben Walker <benjamin.walker@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] pci: Don't call probe callback if driver already loaded.
Date: Thu, 27 Oct 2016 15:28:03 +0200	[thread overview]
Message-ID: <CALwxeUtVUNuvKdyk9Y2EW5-MbrEi8W8e2YV3P39m_NGf8NbN0g@mail.gmail.com> (raw)
In-Reply-To: <1477432240-20406-1-git-send-email-benjamin.walker@intel.com>

Hello Benjamin,

On Tue, Oct 25, 2016 at 11:50 PM, Ben Walker <benjamin.walker@intel.com> 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 <benjamin.walker@intel.com>
> ---
>  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

  reply	other threads:[~2016-10-27 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 21:50 Ben Walker
2016-10-27 13:28 ` David Marchand [this message]
2016-10-27 13:30   ` David Marchand
2016-11-02  9:29 ` Shreyansh Jain
2016-11-06 21:59 ` Thomas Monjalon
2016-11-07  9:02   ` David Marchand
2016-11-07  9:03     ` [dpdk-dev] [PATCH] pci: do not mark device as taken when probe fails David Marchand
2016-11-07 13:42       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALwxeUtVUNuvKdyk9Y2EW5-MbrEi8W8e2YV3P39m_NGf8NbN0g@mail.gmail.com \
    --to=david.marchand@6wind.com \
    --cc=benjamin.walker@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).