Skip to contentSkip to conversation

i40e: Fix eth_i40e_dev_init sequence on ThunderX

PATCH Asok Tiyyagura 1 participant 1 message Nov 30, 2016 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

I can confirm we ran into a similar issue while using ixgbe.

-Asok

Hi

Quoted 14 lines

i40e_asq_send_command: rd32 & wr32 under ThunderX gives unpredictable
results. To solve this include rte memory barriers

---
 drivers/net/i40e/base/i40e_osdep.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/i40e/base/i40e_osdep.h +0 -0
index 38e7ba5..ffa3160 100644

drivers/net/i40e/base/i40e_osdep.h do { \ · line 164

Quoted 7 lines
drivers/net/i40e/base/i40e_osdep.h +4 -0
@@ -158,7 +158,13 @@ do {                                                            \
       ((volatile uint32_t *)((char *)(a)->hw_addr + (reg)))
 static inline uint32_t i40e_read_addr(volatile void *addr)
 {
+#if defined(RTE_ARCH_ARM64)
+     uint32_t val = rte_le_to_cpu_32(I40E_PCI_REG(addr));
+     rte_rmb();
+     return val;

If you really need an rmb/wmb with MMIO read/writes on ARM,
I think you can avoid #ifdefs here and use rte_smp_rmb/rte_smp_wmb. BTW, I suppose if you need it for i40e, you would need it for other devices too. Konstantin

Quoted 25 lines
drivers/net/i40e/base/i40e_osdep.h +10 -1
+#else
       return rte_le_to_cpu_32(I40E_PCI_REG(addr));
+#endif
 }
 #define I40E_PCI_REG_WRITE(reg, value) \
       do { I40E_PCI_REG((reg)) = rte_cpu_to_le_32(value); } while (0)
@@ -171,8 +177,16 @@ static inline uint32_t i40e_read_addr(volatile void *addr)
       I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), (reg)), (value))
 
 #define rd32(a, reg) i40e_read_addr(I40E_PCI_REG_ADDR((a), (reg)))
+#if defined(RTE_ARCH_ARM64)
+#define wr32(a, reg, value) \
+     do { \
+             I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((a), (reg)), (value)); \
+             rte_wmb(); \
+     } while (0)
+#else
 #define wr32(a, reg, value) \
       I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((a), (reg)), (value))
+#endif
 #define flush(a) i40e_read_addr(I40E_PCI_REG_ADDR((a), (I40E_GLGEN_STAT)))
 
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
--

2.7.4