From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <huawei.xie@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 7FCE48E8D
 for <dev@dpdk.org>; Mon,  4 Jan 2016 10:03:14 +0100 (CET)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga104.fm.intel.com with ESMTP; 04 Jan 2016 01:03:13 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,519,1444719600"; d="scan'208";a="627645012"
Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206])
 by FMSMGA003.fm.intel.com with ESMTP; 04 Jan 2016 01:03:03 -0800
Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by
 FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Mon, 4 Jan 2016 01:02:56 -0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.111]) by
 SHSMSX152.ccr.corp.intel.com ([169.254.6.201]) with mapi id 14.03.0248.002;
 Mon, 4 Jan 2016 17:02:54 +0800
From: "Xie, Huawei" <huawei.xie@intel.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH 4/4] virtio: check if any kernel driver is manipulating
 the device
Thread-Index: AdFGzrHjLkJ1ucUXSrm3NoHSmVf6Ig==
Date: Mon, 4 Jan 2016 09:02:53 +0000
Message-ID: <C37D651A908B024F974696C65296B57B4C5730C4@SHSMSX101.ccr.corp.intel.com>
References: <20151222035041.GA7532@pxdev.xzpeter.org>
 <1450982292-129560-1-git-send-email-huawei.xie@intel.com>
 <1450982292-129560-5-git-send-email-huawei.xie@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH 4/4] virtio: check if any kernel driver is
 manipulating the device
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: Mon, 04 Jan 2016 09:03:15 -0000

On 12/25/2015 6:33 PM, Xie, Huawei wrote:=0A=
> virtio PMD could use IO port to configure the virtio device without=0A=
> using uio driver.=0A=
>=0A=
> There are two issues with previous implementation:=0A=
> 1) virtio PMD will take over each virtio device blindly even if some=0A=
> are not intended for DPDK.=0A=
> 2) driver conflict between virtio PMD and virtio-net kernel driver.=0A=
>=0A=
> This patch checks if there is any kernel driver manipulating the virtio=
=0A=
> device before virtio PMD uses IO port to configure the device.=0A=
>=0A=
> Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource")=0A=
>=0A=
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>=0A=
> ---=0A=
>  drivers/net/virtio/virtio_ethdev.c | 7 +++++++=0A=
>  1 file changed, 7 insertions(+)=0A=
>=0A=
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virt=
io_ethdev.c=0A=
> index 00015ef..504346a 100644=0A=
> --- a/drivers/net/virtio/virtio_ethdev.c=0A=
> +++ b/drivers/net/virtio/virtio_ethdev.c=0A=
> @@ -1138,6 +1138,13 @@ static int virtio_resource_init_by_ioports(struct =
rte_pci_device *pci_dev)=0A=
>  	int found =3D 0;=0A=
>  	size_t linesz;=0A=
>  =0A=
> +	if (pci_dev->kdrv !=3D RTE_KDRV_NONE) {=0A=
> +		PMD_INIT_LOG(ERR,=0A=
Better change ERR to INFO and revise the message followed, since user=0A=
might not want to use this device for DPDK.=0A=
> +			"%s(): kernel driver is manipulating this device." \=0A=
> +			" Please unbind the kernel driver.", __func__);=0A=
> +		return -1;=0A=
> +	}=0A=
> +=0A=
>  	snprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT,=0A=
>  		 pci_dev->addr.domain,=0A=
>  		 pci_dev->addr.bus,=0A=
=0A=