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 EF9398E6A for ; Fri, 15 Jan 2016 06:47:27 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 14 Jan 2016 21:47:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,297,1449561600"; d="scan'208";a="29741684" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga004.fm.intel.com with ESMTP; 14 Jan 2016 21:47:26 -0800 Date: Fri, 15 Jan 2016 13:48:53 +0800 From: Yuanhan Liu To: Santosh Shukla Message-ID: <20160115054853.GQ19531@yliu-dev.sh.intel.com> References: <1452778117-30178-1-git-send-email-sshukla@mvista.com> <1452778117-30178-7-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-7-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 06/14] eal: pci: vfio: add rd/wr func for pci bar space 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 05:47:28 -0000 On Thu, Jan 14, 2016 at 06:58:29PM +0530, Santosh Shukla wrote: ... > +int rte_eal_pci_read_bar(const struct rte_pci_device *device, > + void *buf, size_t len, off_t offset, > + int bar_idx) > + > +{ > +#ifdef VFIO_PRESENT > + const struct rte_intr_handle *intr_handle = &device->intr_handle; > + return pci_vfio_read_bar(intr_handle, buf, len, offset, bar_idx); > +#else > + /* UIO's not applicable */ > + RTE_SET_USED(device); > + RTE_SET_USED(buf); > + RTE_SET_USED(len); > + RTE_SET_USED(offset); > + RTE_SET_USED(bar_idx); > + return 0; > +#endif Maybe you could do that like what pci_map_device() does: switch(dev->kdrv) { case RTE_KDRV_NIC_VFIO: return pci_vfio_read_bar(..); break; default: RTE_LOG(.... not supported by driver: %d\n"..); break; } With that, you could get rid of those ugly RTE_SET_USED.... --yliu