From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v4 09/14] virtio: ethdev: check for vfio interface Date: Fri, 15 Jan 2016 14:35:36 +0800 Message-ID: <20160115063536.GT19531@yliu-dev.sh.intel.com> References: <1452778117-30178-1-git-send-email-sshukla@mvista.com> <1452778117-30178-10-git-send-email-sshukla@mvista.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org To: Santosh Shukla Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 684CB5686 for ; Fri, 15 Jan 2016 07:34:10 +0100 (CET) Content-Disposition: inline In-Reply-To: <1452778117-30178-10-git-send-email-sshukla@mvista.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jan 14, 2016 at 06:58:32PM +0530, Santosh Shukla wrote: > Introducing api to check interface type is vfio or not, if interface is vfio > then update struct virtio_vfio_dev {}. > > Those two apis are: > - virtio_chk_for_vfio > - virtio_hw_init_by_vfio > > Signed-off-by: Santosh Shukla .. > +/* Init virtio by vfio-way */ > +static int virtio_hw_init_by_vfio(struct virtio_hw *hw, > + struct rte_pci_device *pci_dev) > +{ > + struct virtio_vfio_dev *vdev; > + > + vdev = &hw->dev; > + if (virtio_chk_for_vfio(pci_dev) < 0) { > + vdev->is_vfio = false; > + vdev->pci_dev = NULL; > + return -1; > + } > + > + /* .. So attached interface is vfio */ > + vdev->is_vfio = true; > + vdev->pci_dev = pci_dev; Normally, I don't like the way of adding yet another "virtio_hw_init_by_xxx". As suggested in another reply, would pci_dev->kdrv checking be enough? If so, do it in simple way. --ylu