[dpdk-dev,v3,25/29] net/nfp: use eal I/O device memory read/write API
diff mbox

Message ID 1484212646-10338-26-git-send-email-jerin.jacob@caviumnetworks.com
State Superseded, archived
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Jerin Jacob Jan. 12, 2017, 9:17 a.m. UTC
From: Santosh Shukla <santosh.shukla@caviumnetworks.com>

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.

CC: Alejandro Lucero <alejandro.lucero@netronome.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/net/nfp/nfp_net_pmd.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Alejandro Lucero Jan. 12, 2017, 10:53 a.m. UTC | #1
Hi,

I've tried to find out which dpdk repo should I use for testing this change
with NFP PMD.

It seems rte_read/write functions are not with last dpdk main repo, nor
with dpdk-net-next.

Can someone tell me which repo should I use?

On Thu, Jan 12, 2017 at 9:17 AM, Jerin Jacob <jerin.jacob@caviumnetworks.com
> wrote:

> From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>
> 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.
>
> CC: Alejandro Lucero <alejandro.lucero@netronome.com>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  drivers/net/nfp/nfp_net_pmd.h | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h
> index c180972..f11b32e 100644
> --- a/drivers/net/nfp/nfp_net_pmd.h
> +++ b/drivers/net/nfp/nfp_net_pmd.h
> @@ -121,25 +121,26 @@ struct nfp_net_adapter;
>  #define NFD_CFG_MINOR_VERSION_of(x) (((x) >> 0) & 0xff)
>
>  #include <linux/types.h>
> +#include <rte_io.h>
>
>  static inline uint8_t nn_readb(volatile const void *addr)
>  {
> -       return *((volatile const uint8_t *)(addr));
> +       return rte_read8(addr);
>  }
>
>  static inline void nn_writeb(uint8_t val, volatile void *addr)
>  {
> -       *((volatile uint8_t *)(addr)) = val;
> +       rte_write8(val, addr);
>  }
>
>  static inline uint32_t nn_readl(volatile const void *addr)
>  {
> -       return *((volatile const uint32_t *)(addr));
> +       return rte_read32(addr);
>  }
>
>  static inline void nn_writel(uint32_t val, volatile void *addr)
>  {
> -       *((volatile uint32_t *)(addr)) = val;
> +       rte_write32(val, addr);
>  }
>
>  static inline uint64_t nn_readq(volatile void *addr)
> --
> 2.5.5
>
>
Jerin Jacob Jan. 12, 2017, 1:40 p.m. UTC | #2
On Thu, Jan 12, 2017 at 10:53:17AM +0000, Alejandro Lucero wrote:
> Hi,
> 
> I've tried to find out which dpdk repo should I use for testing this change
> with NFP PMD.
> 
> It seems rte_read/write functions are not with last dpdk main repo, nor
> with dpdk-net-next.
> 
> Can someone tell me which repo should I use?

It is based on the dpdk main repo. This patchset has 29 patches. The initial
patches in the series contains the definition of rte_read/write.

I have created a temporary branch in public repo to make other users to
test the changes without applying all patches.

https://github.com/jerinjacobk/dpdk.git
branch: rte_io_v3
It is based on today's dpdk master and this patchset.
Alejandro Lucero Jan. 13, 2017, 10:49 a.m. UTC | #3
Thanks for that repo. It really makes things easier.

I have run our NFP PMD unit tests using that repo, and this change seems to
work without no problem.

Thanks again.



On Thu, Jan 12, 2017 at 1:40 PM, Jerin Jacob <jerin.jacob@caviumnetworks.com
> wrote:

> On Thu, Jan 12, 2017 at 10:53:17AM +0000, Alejandro Lucero wrote:
> > Hi,
> >
> > I've tried to find out which dpdk repo should I use for testing this
> change
> > with NFP PMD.
> >
> > It seems rte_read/write functions are not with last dpdk main repo, nor
> > with dpdk-net-next.
> >
> > Can someone tell me which repo should I use?
>
> It is based on the dpdk main repo. This patchset has 29 patches. The
> initial
> patches in the series contains the definition of rte_read/write.
>
> I have created a temporary branch in public repo to make other users to
> test the changes without applying all patches.
>
> https://github.com/jerinjacobk/dpdk.git
> branch: rte_io_v3
> It is based on today's dpdk master and this patchset.
>
>
Jerin Jacob Jan. 13, 2017, 10:57 a.m. UTC | #4
On Fri, Jan 13, 2017 at 10:49:15AM +0000, Alejandro Lucero wrote:
> Thanks for that repo. It really makes things easier.
> 
> I have run our NFP PMD unit tests using that repo, and this change seems to
> work without no problem.
> 
> Thanks again.

Thanks Alejandro. Can I add you Acked by on your NFP PMD specific
change.i.e only for this patch([PATCH v3 25/29] net/nfp: use eal I/O device memory read/write API)

> 
> 
> 
> On Thu, Jan 12, 2017 at 1:40 PM, Jerin Jacob <jerin.jacob@caviumnetworks.com
> > wrote:
> 
> > On Thu, Jan 12, 2017 at 10:53:17AM +0000, Alejandro Lucero wrote:
> > > Hi,
> > >
> > > I've tried to find out which dpdk repo should I use for testing this
> > change
> > > with NFP PMD.
> > >
> > > It seems rte_read/write functions are not with last dpdk main repo, nor
> > > with dpdk-net-next.
> > >
> > > Can someone tell me which repo should I use?
> >
> > It is based on the dpdk main repo. This patchset has 29 patches. The
> > initial
> > patches in the series contains the definition of rte_read/write.
> >
> > I have created a temporary branch in public repo to make other users to
> > test the changes without applying all patches.
> >
> > https://github.com/jerinjacobk/dpdk.git
> > branch: rte_io_v3
> > It is based on today's dpdk master and this patchset.
> >
> >
Alejandro Lucero Jan. 13, 2017, 11:11 a.m. UTC | #5
On Fri, Jan 13, 2017 at 10:57 AM, Jerin Jacob <
jerin.jacob@caviumnetworks.com> wrote:

> On Fri, Jan 13, 2017 at 10:49:15AM +0000, Alejandro Lucero wrote:
> > Thanks for that repo. It really makes things easier.
> >
> > I have run our NFP PMD unit tests using that repo, and this change seems
> to
> > work without no problem.
> >
> > Thanks again.
>
> Thanks Alejandro. Can I add you Acked by on your NFP PMD specific
> change.i.e only for this patch([PATCH v3 25/29] net/nfp: use eal I/O
> device memory read/write API)
>
>
Sure.

Thanks!


> >
> >
> >
> > On Thu, Jan 12, 2017 at 1:40 PM, Jerin Jacob <
> jerin.jacob@caviumnetworks.com
> > > wrote:
> >
> > > On Thu, Jan 12, 2017 at 10:53:17AM +0000, Alejandro Lucero wrote:
> > > > Hi,
> > > >
> > > > I've tried to find out which dpdk repo should I use for testing this
> > > change
> > > > with NFP PMD.
> > > >
> > > > It seems rte_read/write functions are not with last dpdk main repo,
> nor
> > > > with dpdk-net-next.
> > > >
> > > > Can someone tell me which repo should I use?
> > >
> > > It is based on the dpdk main repo. This patchset has 29 patches. The
> > > initial
> > > patches in the series contains the definition of rte_read/write.
> > >
> > > I have created a temporary branch in public repo to make other users to
> > > test the changes without applying all patches.
> > >
> > > https://github.com/jerinjacobk/dpdk.git
> > > branch: rte_io_v3
> > > It is based on today's dpdk master and this patchset.
> > >
> > >
>

Patch
diff mbox

diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h
index c180972..f11b32e 100644
--- a/drivers/net/nfp/nfp_net_pmd.h
+++ b/drivers/net/nfp/nfp_net_pmd.h
@@ -121,25 +121,26 @@  struct nfp_net_adapter;
 #define NFD_CFG_MINOR_VERSION_of(x) (((x) >> 0) & 0xff)
 
 #include <linux/types.h>
+#include <rte_io.h>
 
 static inline uint8_t nn_readb(volatile const void *addr)
 {
-	return *((volatile const uint8_t *)(addr));
+	return rte_read8(addr);
 }
 
 static inline void nn_writeb(uint8_t val, volatile void *addr)
 {
-	*((volatile uint8_t *)(addr)) = val;
+	rte_write8(val, addr);
 }
 
 static inline uint32_t nn_readl(volatile const void *addr)
 {
-	return *((volatile const uint32_t *)(addr));
+	return rte_read32(addr);
 }
 
 static inline void nn_writel(uint32_t val, volatile void *addr)
 {
-	*((volatile uint32_t *)(addr)) = val;
+	rte_write32(val, addr);
 }
 
 static inline uint64_t nn_readq(volatile void *addr)