From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 14 Jan 2016 22:34:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,298,1449561600"; d="scan'208";a="893653992" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga002.fm.intel.com with ESMTP; 14 Jan 2016 22:34:07 -0800 Date: Fri, 15 Jan 2016 14:35:36 +0800 From: Yuanhan Liu To: Santosh Shukla 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 Content-Disposition: inline In-Reply-To: <1452778117-30178-10-git-send-email-sshukla@mvista.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v4 09/14] virtio: ethdev: check for vfio interface 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: Fri, 15 Jan 2016 06:34:10 -0000 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