From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5D116C356 for ; Thu, 28 Jan 2016 08:15:54 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 27 Jan 2016 23:15:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,357,1449561600"; d="scan'208";a="902741947" Received: from dpdk15.sh.intel.com ([10.239.129.25]) by fmsmga002.fm.intel.com with ESMTP; 27 Jan 2016 23:15:51 -0800 From: Huawei Xie To: dev@dpdk.org, thomas.monjalon@6wind.com Date: Wed, 27 Jan 2016 23:21:22 +0800 Message-Id: <1453908082-92036-5-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1453908082-92036-1-git-send-email-huawei.xie@intel.com> References: <20151222035041.GA7532@pxdev.xzpeter.org> <1453908082-92036-1-git-send-email-huawei.xie@intel.com> Cc: nikita.troitsky@intel.com Subject: [dpdk-dev] [PATCH v3 4/4] virtio: check if kernel driver is manipulating the virtio 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: Thu, 28 Jan 2016 07:15:54 -0000 v3 changes: change log message to tell user that the virtio device is skipped due to it is managed by kernel driver, instead of asking user to unbind it from kernel driver. v2 changes: change LOG level from ERR to INFO virtio PMD could use IO port to configure the virtio device without using uio driver(vfio-noniommu mode should work as well). 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index e815acd..ea1874a 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1138,6 +1138,11 @@ 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(INFO, "skip kernel managed virtio device."); + return -1; + } + snprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT, pci_dev->addr.domain, pci_dev->addr.bus, -- 1.8.1.4