net/mlx5: optimize copy of Ethernet header
authorNélio Laranjeiro <nelio.laranjeiro@6wind.com>
Thu, 24 Nov 2016 16:03:35 +0000 (17:03 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:40:53 +0000 (19:40 +0100)
Use fewer instructions to copy the first two bytes of Ethernet headers to
work queue elements.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5_rxtx.c

index 46fb252..380d137 100644 (file)
@@ -408,7 +408,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                uintptr_t addr;
                uint64_t naddr;
                uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE;
-               uint8_t ehdr[2];
+               uint16_t ehdr;
                uint8_t cs_flags = 0;
 #ifdef MLX5_PMD_SOFT_COUNTERS
                uint32_t total_length = 0;
@@ -435,8 +435,8 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                        rte_prefetch0(*pkts);
                addr = rte_pktmbuf_mtod(buf, uintptr_t);
                length = DATA_LEN(buf);
-               ehdr[0] = ((uint8_t *)addr)[0];
-               ehdr[1] = ((uint8_t *)addr)[1];
+               ehdr = (((uint8_t *)addr)[1] << 8) |
+                      ((uint8_t *)addr)[0];
 #ifdef MLX5_PMD_SOFT_COUNTERS
                total_length = length;
 #endif
@@ -599,8 +599,7 @@ next_pkt:
                        0,
                        cs_flags,
                        0,
-                       (ehdr[1] << 24) | (ehdr[0] << 16) |
-                       htons(pkt_inline_sz),
+                       (ehdr << 16) | htons(pkt_inline_sz),
                };
                txq->wqe_ci += (ds + 3) / 4;
 #ifdef MLX5_PMD_SOFT_COUNTERS