app/testpmd: fix build for IBM Power
authorChao Zhu <chaozhu@linux.vnet.ibm.com>
Tue, 25 Nov 2014 22:17:17 +0000 (17:17 -0500)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 26 Nov 2014 20:50:10 +0000 (21:50 +0100)
This patch fixes compiling problems on IBM Power architecture and turn
on the test-pmd compiling option in configuration file. Actually, this
is an big endian compiling fix.

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@6wind.com>
app/test-pmd/config.c

index 71b34dd..a4c16fc 100644 (file)
@@ -628,8 +628,13 @@ ring_dma_zone_lookup(const char *ring_name, uint8_t port_id, uint16_t q_id)
 union igb_ring_dword {
        uint64_t dword;
        struct {
+#ifdef RTE_ARCH_BIG_ENDIAN
+               uint32_t lo;
+               uint32_t hi;
+#else
                uint32_t hi;
                uint32_t lo;
+#endif
        } words;
 };
 
@@ -672,23 +677,29 @@ ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
                /* 32 bytes RX descriptor, i40e only */
                struct igb_ring_desc_32_bytes *ring =
                        (struct igb_ring_desc_32_bytes *)ring_mz->addr;
+               ring[desc_id].lo_dword.dword =
+                       rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+               ring_rxd_display_dword(ring[desc_id].lo_dword);
+               ring[desc_id].hi_dword.dword =
+                       rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
+               ring_rxd_display_dword(ring[desc_id].hi_dword);
+               ring[desc_id].resv1.dword =
+                       rte_le_to_cpu_64(ring[desc_id].resv1.dword);
+               ring_rxd_display_dword(ring[desc_id].resv1);
+               ring[desc_id].resv2.dword =
+                       rte_le_to_cpu_64(ring[desc_id].resv2.dword);
+               ring_rxd_display_dword(ring[desc_id].resv2);
 
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].lo_dword));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].hi_dword));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].resv1));
-               ring_rxd_display_dword(rte_le_to_cpu_64(
-                               ring[desc_id].resv2));
                return;
        }
 #endif
        /* 16 bytes RX descriptor */
-       ring_rxd_display_dword(rte_le_to_cpu_64(
-                       ring[desc_id].lo_dword));
-       ring_rxd_display_dword(rte_le_to_cpu_64(
-                       ring[desc_id].hi_dword));
+       ring[desc_id].lo_dword.dword =
+               rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+       ring_rxd_display_dword(ring[desc_id].lo_dword);
+       ring[desc_id].hi_dword.dword =
+               rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
+       ring_rxd_display_dword(ring[desc_id].hi_dword);
 }
 
 static void
@@ -698,8 +709,8 @@ ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
        struct igb_ring_desc_16_bytes txd;
 
        ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
-       txd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
-       txd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
+       txd.lo_dword.dword = rte_le_to_cpu_64(ring[desc_id].lo_dword.dword);
+       txd.hi_dword.dword = rte_le_to_cpu_64(ring[desc_id].hi_dword.dword);
        printf("    0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
                        (unsigned)txd.lo_dword.words.lo,
                        (unsigned)txd.lo_dword.words.hi,