DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: "Tao, Zhe" <zhe.tao@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] i40e: Fix the endian issue for the i40e read&write registers functions
Date: Wed, 15 Jul 2015 01:01:31 +0000	[thread overview]
Message-ID: <9BB6961774997848B5B42BEC655768F8C681A1@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1436870216-12926-1-git-send-email-zhe.tao@intel.com>



> -----Original Message-----
> From: Tao, Zhe
> Sent: Tuesday, July 14, 2015 6:37 PM
> To: dev@dpdk.org
> Cc: Tao, Zhe; Wu, Jingjing
> Subject: [PATCH] i40e: Fix the endian issue for the i40e read&write registers
> functions
> 
> Linux kernel uses the writel and readl related functions to perform the PCI
> memory access via ioremap region, those functions will handle the big little
> endian properly by doing the conversion between little and big endian if
> necessary, so Add this conversion in the read&write registers functions for
> i40e.
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
>  drivers/net/i40e/base/i40e_osdep.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/base/i40e_osdep.h
> b/drivers/net/i40e/base/i40e_osdep.h
> index 3ce8057..d35c494 100644
> --- a/drivers/net/i40e/base/i40e_osdep.h
> +++ b/drivers/net/i40e/base/i40e_osdep.h
> @@ -122,10 +122,10 @@ do {                                                            \
>  	((volatile uint32_t *)((char *)(a)->hw_addr + (reg)))  static inline
> uint32_t i40e_read_addr(volatile void *addr)  {
> -	return I40E_PCI_REG(addr);
> +	return rte_cpu_to_le_32(I40E_PCI_REG(addr));

I think we need use rte_le_to_cpu_32 but not rte_cpu_to_le_32 for reading.

>  }
>  #define I40E_PCI_REG_WRITE(reg, value) \
> -	do {I40E_PCI_REG((reg)) = (value);} while(0)
> +	do { I40E_PCI_REG((reg)) = rte_cpu_to_le_32(value); } while (0)
> 
>  #define I40E_WRITE_FLUSH(a) I40E_READ_REG(a, I40E_GLGEN_STAT)
> #define I40EVF_WRITE_FLUSH(a) I40E_READ_REG(a, I40E_VFGEN_RSTAT)
> --
> 1.9.3

  parent reply	other threads:[~2015-07-15  1:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 10:36 Zhe Tao
2015-07-14 20:03 ` Thomas Monjalon
2015-07-15  1:01 ` Wu, Jingjing [this message]
2015-07-17  3:46 ` [dpdk-dev] [PATCH v2] " Zhe Tao
2015-07-17  7:25   ` [dpdk-dev] [PATCH v3] i40e: " Zhe Tao
2015-07-17  8:09     ` Chao Zhu
2015-07-19 23:17       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9BB6961774997848B5B42BEC655768F8C681A1@SHSMSX104.ccr.corp.intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    --cc=zhe.tao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).