From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D93A258ED for ; Mon, 28 Dec 2015 06:24:44 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 27 Dec 2015 21:24:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,489,1444719600"; d="scan'208";a="882038530" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga002.fm.intel.com with ESMTP; 27 Dec 2015 21:24:42 -0800 Date: Mon, 28 Dec 2015 13:26:58 +0800 From: Yuanhan Liu To: Huawei Xie Message-ID: <20151228052658.GE18863@yliu-dev.sh.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450982292-129560-5-git-send-email-huawei.xie@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 05:24:45 -0000 On Fri, Dec 25, 2015 at 02:38:12AM +0800, Huawei Xie wrote: > virtio PMD could use IO port to configure the virtio device without > using uio driver. > > There are two issues with previous implementation: > 1) virtio PMD will take over each virtio device blindly even if some > are not intended for DPDK. > 2) driver conflict between virtio PMD and virtio-net kernel driver. > > This patch checks if there is any kernel driver manipulating the virtio > device before virtio PMD uses IO port to configure the device. > > Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource") > > Signed-off-by: Huawei Xie > --- > drivers/net/virtio/virtio_ethdev.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 00015ef..504346a 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1138,6 +1138,13 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev) > int found = 0; > size_t linesz; > > + if (pci_dev->kdrv != RTE_KDRV_NONE) { > + PMD_INIT_LOG(ERR, > + "%s(): kernel driver is manipulating this device." \ > + " Please unbind the kernel driver.", __func__); PMD_INIT_LOG already prints the function, no need to reference __func__ again here. --yliu > + return -1; > + } > + > snprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT, > pci_dev->addr.domain, > pci_dev->addr.bus, > -- > 1.8.1.4