From mboxrd@z Thu Jan 1 00:00:00 1970 From: Santosh Shukla Subject: Re: [PATCH 26/28] net/virtio: use eal I/O device memory read/write API Date: Wed, 14 Dec 2016 21:45:34 -0800 Message-ID: <20161215054533.GA10211@santosh-Latitude-E5530-non-vPro> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> <1481680558-4003-27-git-send-email-jerin.jacob@caviumnetworks.com> <20161214030223.GH18991@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: Jerin Jacob , , , , , , , Huawei Xie To: Yuanhan Liu Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0079.outbound.protection.outlook.com [104.47.32.79]) by dpdk.org (Postfix) with ESMTP id 74E8F2934 for ; Thu, 15 Dec 2016 06:45:45 +0100 (CET) Content-Disposition: inline In-Reply-To: <20161214030223.GH18991@yliu-dev.sh.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Dec 14, 2016 at 11:02:23AM +0800, Yuanhan Liu wrote: > On Wed, Dec 14, 2016 at 07:25:56AM +0530, Jerin Jacob wrote: > > * Following macros are derived from linux/pci_regs.h, however, > > * we can't simply include that header here, as there is no such > > @@ -320,37 +322,37 @@ static const struct virtio_pci_ops legacy_ops = { > > static inline uint8_t > > io_read8(uint8_t *addr) > > { > > - return *(volatile uint8_t *)addr; > > + return rte_readb(addr); > > } > > Oh, one more comments: why not replacing io_read8 with rte_readb(), > and do similar for others? Then we don't have to define those wrappers. > > I think you can also do something similar for other patches? Make sense for the virtio-pci case where API name io_read/write as good as rte_read/write. However, IMO for other drivers for example ADF_CSR_RD/WR improves code readability compared to plain rte_read/write. Also IMO replacing code incident like below static inline void writel(unsigned int val, volatile void __iomem *addr) { - *(volatile unsigned int *)addr = val; + rte_writel(val, addr); } with direct rte_read/write more appropriate. does above said make sense to you? If so then I will take care for all such driver in V2. --Santosh. > --yliu > > > > static inline void > > io_write8(uint8_t val, uint8_t *addr) > > { > > - *(volatile uint8_t *)addr = val; > > + rte_writeb(val, addr); > > } > > > > static inline uint16_t > > io_read16(uint16_t *addr) > > { > > - return *(volatile uint16_t *)addr; > > + return rte_readw(addr); > > } > > > > static inline void > > io_write16(uint16_t val, uint16_t *addr) > > { > > - *(volatile uint16_t *)addr = val; > > + rte_writew(val, addr); > > } > > > > static inline uint32_t > > io_read32(uint32_t *addr) > > { > > - return *(volatile uint32_t *)addr; > > + return rte_readl(addr); > > } > > > > static inline void > > io_write32(uint32_t val, uint32_t *addr) > > { > > - *(volatile uint32_t *)addr = val; > > + rte_writel(val, addr); > > } > > > > static inline void > > -- > > 2.5.5