From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <iryzhov@nfware.com>
Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com
 [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 70EB41DB1
 for <dev@dpdk.org>; Thu,  4 Aug 2016 13:51:37 +0200 (CEST)
Received: by mail-lf0-f67.google.com with SMTP id f93so14663541lfi.0
 for <dev@dpdk.org>; Thu, 04 Aug 2016 04:51:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=nfware-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=w45/gmxP2EDqcRunVVuhLR0rfe8+7oL0FusPSYaOy5g=;
 b=hgA+HcOizo1CK/ExQaXp3syz0ZwNgNMPGbaIxJ3lxOHqeTJPiOPQ3AF53V9E+PWZS/
 xlmfNaX/2+SAiEwEA9sCsyLiMCcL6A5IEga0pA1iEHoMwnSSJiEsymi3Xp6Q5i2goFmn
 3xW+KUMv2sFGvQJ6OJcEug8Hf3W4TIvV8MJqq3Vedrcv8qE6V/D8CuHKSGC97I14lMg6
 njKLR3i7ho7z/2b+p7yCHHjrr4HxPlO6ZTvDCN/z1KlrVZfFZDUNaVoBR+1Q8gQNQPjW
 1CxShTb5ddiY2zbV+6VwSzUhxvmECkDdtD4R8t4rudX0C9eN+7wK6dLxpXsKz1HucAQk
 92EQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=w45/gmxP2EDqcRunVVuhLR0rfe8+7oL0FusPSYaOy5g=;
 b=ZtriDn2UgjEOdwgPAFjqwaI8WxGsbRCyCxf7MDLms3RexBfkqheiJULmSGway3mEIJ
 +/j6P1R0luMaFlefudiM8cY6WxyFfNyYW52pJGXRRtlGcienGGMUAzI4lpqnJsHZEulF
 4fdCYycGycM7K3NUOIwkHDWrWnBfQ/UfuLNH8F7tvLqBjHJsTII0g/HvAbDafI8xGWSQ
 s8QJXNn+XUR+G/uTfbX7zD4cDQlFrGP27+GCqGiYAnm2cYETQbUEyfCu3AMoyxNWHw3m
 xml3LHG3HhT60meKCxPZmKfoxYyb4jfCuwKfRrW3OjBlfItmTcr7qvYV7OUdbyItp2JU
 IGtg==
X-Gm-Message-State: AEkoouuNOFCmqNB71D1wh2TFGVK3i3Ajg+lK3Cuu3eM4E6OY6IGO2jaelT58i9Jo54t3Sg==
X-Received: by 10.25.133.138 with SMTP id h132mr19416693lfd.210.1470311497027; 
 Thu, 04 Aug 2016 04:51:37 -0700 (PDT)
Received: from [172.20.100.10] (vpn.arccn.ru. [95.182.74.2])
 by smtp.gmail.com with ESMTPSA id 29sm2336270lfu.43.2016.08.04.04.51.36
 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Thu, 04 Aug 2016 04:51:36 -0700 (PDT)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Igor Ryzhov <iryzhov@nfware.com>
In-Reply-To: <57A32814.1000404@intel.com>
Date: Thu, 4 Aug 2016 14:51:35 +0300
Cc: dev@dpdk.org,
 David Marchand <david.marchand@6wind.com>
Content-Transfer-Encoding: quoted-printable
Message-Id: <0AB336DF-9C66-4826-BA17-EDE1F8D6A2EA@nfware.com>
References: <E1025756-36BA-4BC3-AA5D-279AE1025530@nfware.com>
 <57A32814.1000404@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
X-Mailer: Apple Mail (2.3124)
Subject: Re: [dpdk-dev] rte_eth_dev_attach returns 0,
	although device is not attached
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Aug 2016 11:51:37 -0000

Hello Ferruh,

> 4 =D0=B0=D0=B2=D0=B3. 2016 =D0=B3., =D0=B2 14:33, Ferruh Yigit =
<ferruh.yigit@intel.com> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0=
):
>=20
> Hi Igor,
>=20
> On 8/3/2016 5:58 PM, Igor Ryzhov wrote:
>> Hello.
>>=20
>> 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 =3D pci_probe_all_drivers(dev);
>> if (ret < 0)
>> 	goto err_return;
>> return 0;
>> (pci_probe_all_drivers returns 1 in that case)
>>=20
>> For example, it can be easily reproduced by trying to attach virtio =
device, managed by kernel driver.
>=20
> You are right, and I did able to reproduce this issue with virtio as =
you
> suggest.
>=20
> 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.
>=20
>>=20
>> I think it should be:
>> ret =3D pci_probe_all_drivers(dev);
>> if (ret)
>> 	goto err_return;
>> return 0;
>=20
> Your proposal looks good to me. Will you send a patch?

Patch sent.

>=20
>> Best regards,
>> Igor
>>=20
>=20