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 C7AB4530F for ; Wed, 14 Dec 2016 03:53:48 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 13 Dec 2016 18:53:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="797742671" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by FMSMGA003.fm.intel.com with ESMTP; 13 Dec 2016 18:53:45 -0800 Date: Wed, 14 Dec 2016 10:55:34 +0800 From: Yuanhan Liu To: Jerin Jacob Cc: dev@dpdk.org, konstantin.ananyev@intel.com, thomas.monjalon@6wind.com, bruce.richardson@intel.com, jianbo.liu@linaro.org, viktorin@rehivetech.com, Santosh Shukla , Yong Wang Message-ID: <20161214025534.GG18991@yliu-dev.sh.intel.com> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> <1481680558-4003-28-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1481680558-4003-28-git-send-email-jerin.jacob@caviumnetworks.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 27/28] net/vmxnet3: use eal I/O device memory read/write API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2016 02:53:49 -0000 On Wed, Dec 14, 2016 at 07:25:57AM +0530, Jerin Jacob wrote: > From: Santosh Shukla > > Replace the raw I/O device memory read/write access with eal > abstraction for I/O device memory read/write access to fix > portability issues across different architectures. > > Signed-off-by: Santosh Shukla > Signed-off-by: Jerin Jacob > CC: Yong Wang > --- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h > index 7d3b11e..5b6501b 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h > @@ -34,6 +34,8 @@ > #ifndef _VMXNET3_ETHDEV_H_ > #define _VMXNET3_ETHDEV_H_ > > +#include > + > #define VMXNET3_MAX_MAC_ADDRS 1 > > /* UPT feature to negotiate */ > @@ -120,7 +122,11 @@ struct vmxnet3_hw { > > /* Config space read/writes */ > > -#define VMXNET3_PCI_REG(reg) (*((volatile uint32_t *)(reg))) > +#define VMXNET3_PCI_REG(reg) ({ \ > + uint32_t __val; \ > + __val = rte_readl(reg); \ > + __val; \ > +}) Why not simply using rte_readl directly? #define VMXNET3_PCI_REG(reg) rte_readl(reg) > > static inline uint32_t > vmxnet3_read_addr(volatile void *addr) > @@ -128,9 +134,9 @@ vmxnet3_read_addr(volatile void *addr) > return VMXNET3_PCI_REG(addr); > } > > -#define VMXNET3_PCI_REG_WRITE(reg, value) do { \ > - VMXNET3_PCI_REG((reg)) = (value); \ > -} while(0) > +#define VMXNET3_PCI_REG_WRITE(reg, value) ({ \ > + rte_writel(value, reg); \ > +}) I think this could be done in one line. --yliu