From: NĂ©lio Laranjeiro Date: Thu, 24 Nov 2016 16:03:35 +0000 (+0100) Subject: net/mlx5: optimize copy of Ethernet header X-Git-Tag: spdx-start~4870 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=eef822dd73d4cc0ee5b998d75c8b6faf9b859d02;p=dpdk.git net/mlx5: optimize copy of Ethernet header Use fewer instructions to copy the first two bytes of Ethernet headers to work queue elements. Signed-off-by: Nelio Laranjeiro Acked-by: Adrien Mazarguil --- diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 46fb252fd7..380d137271 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -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