[dpdk-dev,v3] i40e: Fix the endian issue for the i40e read&write registers functions

Message ID 1437117940-7849-1-git-send-email-zhe.tao@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Zhe Tao July 17, 2015, 7:25 a.m. UTC
Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
PATCH v3: Edit the subject make it more clear

PATCH v2: Edit the comments make it more clear

PATCH v1: Add the endian conversion for registers operations.

 drivers/net/i40e/base/i40e_osdep.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Chao Zhu July 17, 2015, 8:09 a.m. UTC | #1
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>

On 2015/7/17 15:25, Zhe Tao wrote:
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
> PATCH v3: Edit the subject make it more clear
>
> PATCH v2: Edit the comments make it more clear
>
> PATCH v1: Add the endian conversion for registers operations.
>
>   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..70d2721 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_le_to_cpu_32(I40E_PCI_REG(addr));
>   }
>   #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)
  
Thomas Monjalon July 19, 2015, 11:17 p.m. UTC | #2
There was no explanation.
The changed title should be more explicit:
"i40e: fix registers access from big endian CPU"

> > Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index 3ce8057..70d2721 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_le_to_cpu_32(I40E_PCI_REG(addr));
 }
 #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)