All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Igor Ryzhov <iryzhov@nfware.com>, dev@dpdk.org
Cc: David Marchand <david.marchand@6wind.com>
Subject: Re: rte_eth_dev_attach returns 0, although device is not attached
Date: Thu, 4 Aug 2016 12:33:40 +0100	[thread overview]
Message-ID: <57A32814.1000404@intel.com> (raw)
In-Reply-To: <E1025756-36BA-4BC3-AA5D-279AE1025530@nfware.com>

Hi Igor,

On 8/3/2016 5:58 PM, Igor Ryzhov wrote:
> Hello.
> 
> Function rte_eth_dev_attach can return false positive result.
> It happens because rte_eal_pci_probe_one returns zero if no driver is found for the device:
> ret = pci_probe_all_drivers(dev);
> if (ret < 0)
> 	goto err_return;
> return 0;
> (pci_probe_all_drivers returns 1 in that case)
> 
> For example, it can be easily reproduced by trying to attach virtio device, managed by kernel driver.

You are right, and I did able to reproduce this issue with virtio as you
suggest.

But I wonder why rte_eth_dev_get_port_by_addr() is not catching this.
Perhaps a dev->attached check needs to be added into this function.

> 
> I think it should be:
> ret = pci_probe_all_drivers(dev);
> if (ret)
> 	goto err_return;
> return 0;

Your proposal looks good to me. Will you send a patch?

> Best regards,
> Igor
> 

  reply	other threads:[~2016-08-04 11:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 16:58 rte_eth_dev_attach returns 0, although device is not attached Igor Ryzhov
2016-08-04 11:33 ` Ferruh Yigit [this message]
2016-08-04 11:51   ` Igor Ryzhov
2016-08-04 13:21     ` Ferruh Yigit
2016-08-04 14:54       ` Igor Ryzhov
2016-08-04 15:47         ` Ferruh Yigit
2016-08-05 12:29           ` Bruce Richardson

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=57A32814.1000404@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=iryzhov@nfware.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.