From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f179.google.com (mail-yw0-f179.google.com [209.85.161.179]) by dpdk.org (Postfix) with ESMTP id A9A9710A7 for ; Thu, 15 Dec 2016 09:37:13 +0100 (CET) Received: by mail-yw0-f179.google.com with SMTP id i145so10001935ywg.2 for ; Thu, 15 Dec 2016 00:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0+JWdt9VUNkkeUb5QCQdcfUyCksNhuRvDlwdPj4TSPk=; b=UvePt8QlN0dmHwrEbTSQMHWHKPeVVPFXOoEzommA5QoYzA6Jg3CA47+ncUOHaRyk7v O9JUsQTYYOOZX5czReZohXr3rtjJJ+rc/nNL7Swhn+4lcmECxTfX7D0emZkMQrDKPi4A 9Ef7TBqvO3eDSx3ufsWTmbrznj5SGk1gp9AJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0+JWdt9VUNkkeUb5QCQdcfUyCksNhuRvDlwdPj4TSPk=; b=Tfv6HMwRYfQgn3Z3ywXXM7ayIkDPWViOwD5hKsv7wGrbBeERaLKzXTOyeHfoyjsVa3 Ee/9kdBZ2Jg7ifsKrQwGJ0EaKosuhlWzhUUuEbvqA36YbEDVlbqWEdrDoRZMVA2lvPk/ SqX14qHFdGlYk8tk9gwLGcSpHWQgYzWNTaCVfjXSc8ldxfFyPRvvuItfJoSk50Q4pCm6 TPFi6vpgoTlJWMdLOUsbAJBu9Vgu67xJHmQEt9u56F+G633oFrYY0D68VhOaNs6nnscu G+327JH2Z/uy3J3C+c/GNOMlH9GIyH25DnMeZrZZ7Yw9JvcMMQZkcjBwTYeDJh5R2b1v 7e3A== X-Gm-Message-State: AKaTC03Z63yPXKgmBpHxdvdnPc79ON/HjXw/ktCebm29yaOX2VGXwFJPwYi2s79y6Uibym1B7badbc8L1JF57EGW X-Received: by 10.129.138.67 with SMTP id a64mr104086ywg.43.1481791033056; Thu, 15 Dec 2016 00:37:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.193.131 with HTTP; Thu, 15 Dec 2016 00:37:12 -0800 (PST) In-Reply-To: <1481680558-4003-24-git-send-email-jerin.jacob@caviumnetworks.com> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> <1481680558-4003-24-git-send-email-jerin.jacob@caviumnetworks.com> From: Jianbo Liu Date: Thu, 15 Dec 2016 16:37:12 +0800 Message-ID: To: Jerin Jacob Cc: dev@dpdk.org, "Ananyev, Konstantin" , Thomas Monjalon , Bruce Richardson , Jan Viktorin , Santosh Shukla , Helin Zhang Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH 23/28] net/ixgbe: 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: Thu, 15 Dec 2016 08:37:14 -0000 On 14 December 2016 at 09:55, 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: Helin Zhang > CC: Konstantin Ananyev > --- > drivers/net/ixgbe/base/ixgbe_osdep.h | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h > index 77f0af5..9d16c21 100644 > --- a/drivers/net/ixgbe/base/ixgbe_osdep.h > +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h > @@ -44,6 +44,7 @@ > #include > #include > #include > +#include > > #include "../ixgbe_logs.h" > #include "../ixgbe_bypass_defines.h" > @@ -121,16 +122,20 @@ typedef int bool; > > #define prefetch(x) rte_prefetch0(x) > > -#define IXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg))) > +#define IXGBE_PCI_REG(reg) ({ \ > + uint32_t __val; \ > + __val = rte_readl(reg); \ > + __val; \ > +}) > > static inline uint32_t ixgbe_read_addr(volatile void* addr) > { > return rte_le_to_cpu_32(IXGBE_PCI_REG(addr)); > } > > -#define IXGBE_PCI_REG_WRITE(reg, value) do { \ > - IXGBE_PCI_REG((reg)) = (rte_cpu_to_le_32(value)); \ > -} while(0) > +#define IXGBE_PCI_REG_WRITE(reg, value) ({ \ > + rte_writel(rte_cpu_to_le_32(value), reg); \ > +}) > memory barrier operation is put inside IXGBE_PCI_REG_READ/WRITE in your change, but I found rte_*mb is called before these macros in some places. Can you remove all these redundant calls? And please do the same checking for other drivers. > #define IXGBE_PCI_REG_ADDR(hw, reg) \ > ((volatile uint32_t *)((char *)(hw)->hw_addr + (reg))) > -- > 2.5.5 >