From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f171.google.com (mail-wj0-f171.google.com [209.85.210.171]) by dpdk.org (Postfix) with ESMTP id 2D2EB12A8 for ; Thu, 24 Nov 2016 17:04:01 +0100 (CET) Received: by mail-wj0-f171.google.com with SMTP id mp19so36891192wjc.1 for ; Thu, 24 Nov 2016 08:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=L+BhfyIvB2mvfXmNg4+M0F3z3WhUsN3kq2KcwjWSa5c=; b=mqLWiGBrg8dgtr0pouih3/rWZ+Hi7OyHNqK8QQB6VB2HpEGVRJQWJ2fMBKzgBtspLx GhHgvMbZR3+tHEjdR3m/rgU39OXNsbU5VSKbEBim6aMSAvR7yApBz4WHxxroleJCjqM4 ipT0Rm0ysh/QMqyyozF0f8tFu0TIN6S/z5FQb+SN9nwiyTLJjvVSIt3zyhS3H6JOtdNJ TKxeeyHGrdHauytsCH3Jx1M5ni1uJ2rmiwVI8NSEU2DN4LipxHXUinLgQvqxShF0j4LN 6hvphRfIMWNjvYgLWXbPiKaF/Ml7vZ6fxW9h5IA+335maxaMu8bn+DMLc6SOnoPNI8NO L6bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=L+BhfyIvB2mvfXmNg4+M0F3z3WhUsN3kq2KcwjWSa5c=; b=T+NGatTSqMIq0EwPz/5uEyTYJ/K9iXL/qM/SbvVfqGLUXivF6l3DqS8twmvCU4NFjl XMHmMQa9rIP6FPS91aRaa4PgFxS696JT9+TLdwtqzAKe9qfWKLBnknPznap4JNsYGZzD 0u9mhFYpI1SLdCIUYl6MTD1xa5hLiG2PhO9ExARZ2PzmzY8cbOotPS1teqnoN2O4BN9y YszGhZe0Gxod7JJ560D2Aun/Zta36VpkfdQoJPM8hJ1zQL9vvJmgSh5oxU1tlvK+KgnX Epsl0Y3w4IwPrD2TJ46JLYXU5JRBNG7wHR0DTfS0Bwwr1uEO4qHbQtkoGd2ylgrzkw/T cIJw== X-Gm-Message-State: AKaTC03n/xBKkGwrX1IvH0CKVT5HvFHXhudycrBLjWhmibeabApu8oLYvJ9od2r57UwktUZZ X-Received: by 10.194.127.40 with SMTP id nd8mr3301553wjb.43.1480003440788; Thu, 24 Nov 2016 08:04:00 -0800 (PST) Received: from ping.vm.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id vr9sm42495142wjc.35.2016.11.24.08.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Nov 2016 08:04:00 -0800 (PST) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Thomas Monjalon , Adrien Mazarguil , Elad Persiko Date: Thu, 24 Nov 2016 17:03:30 +0100 Message-Id: <2f1fc4f55baa1c0d407f4097d481f3f1a951510b.1479995764.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 1/7] net/mlx5: prepare Tx vectorization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Nov 2016 16:04:01 -0000 Prepare the code to write the Work Queue Element with vectorized instructions. Signed-off-by: Nelio Laranjeiro Signed-off-by: Elad Persiko Acked-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_rxtx.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index ffd09ac..5dacd93 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -391,6 +391,8 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) uint32_t length; unsigned int ds = 0; uintptr_t addr; + uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE; + uint8_t ehdr[2]; #ifdef MLX5_PMD_SOFT_COUNTERS uint32_t total_length = 0; #endif @@ -416,6 +418,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]; #ifdef MLX5_PMD_SOFT_COUNTERS total_length = length; #endif @@ -439,24 +443,20 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) } else { wqe->eseg.cs_flags = 0; } - raw = (uint8_t *)(uintptr_t)&wqe->eseg.inline_hdr[0]; - /* Start the know and common part of the WQE structure. */ - wqe->ctrl[0] = htonl((txq->wqe_ci << 8) | MLX5_OPCODE_SEND); - wqe->ctrl[2] = 0; - wqe->ctrl[3] = 0; - wqe->eseg.rsvd0 = 0; - wqe->eseg.rsvd1 = 0; - wqe->eseg.mss = 0; - wqe->eseg.rsvd2 = 0; - /* Start by copying the Ethernet Header. */ - memcpy((uint8_t *)raw, ((uint8_t *)addr), 16); + raw = ((uint8_t *)(uintptr_t)wqe) + 2 * MLX5_WQE_DWORD_SIZE; + /* + * Start by copying the Ethernet header minus the first two + * bytes which will be appended at the end of the Ethernet + * segment. + */ + memcpy((uint8_t *)raw, ((uint8_t *)addr) + 2, 16); length -= MLX5_WQE_DWORD_SIZE; addr += MLX5_WQE_DWORD_SIZE; /* Replace the Ethernet type by the VLAN if necessary. */ if (buf->ol_flags & PKT_TX_VLAN_PKT) { uint32_t vlan = htonl(0x81000000 | buf->vlan_tci); - memcpy((uint8_t *)(raw + MLX5_WQE_DWORD_SIZE - + memcpy((uint8_t *)(raw + MLX5_WQE_DWORD_SIZE - 2 - sizeof(vlan)), &vlan, sizeof(vlan)); addr -= sizeof(vlan); @@ -468,10 +468,13 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) (uintptr_t)&(*txq->wqes)[1 << txq->wqe_n]; uint16_t max_inline = txq->max_inline * RTE_CACHE_LINE_SIZE; - uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE; uint16_t room; - raw += MLX5_WQE_DWORD_SIZE; + /* + * raw starts two bytes before the boundary to + * continue the above copy of packet data. + */ + raw += MLX5_WQE_DWORD_SIZE - 2; room = end - (uintptr_t)raw; if (room > max_inline) { uintptr_t addr_end = (addr + max_inline) & @@ -487,8 +490,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) /* Sanity check. */ assert(addr <= addr_end); } - /* Store the inlined packet size in the WQE. */ - wqe->eseg.inline_hdr_sz = htons(pkt_inline_sz); /* * 2 DWORDs consumed by the WQE header + 1 DSEG + * the size of the inline part of the packet. @@ -570,7 +571,18 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) --pkts_n; next_pkt: ++i; + /* Initialize known and common part of the WQE structure. */ + wqe->ctrl[0] = htonl((txq->wqe_ci << 8) | MLX5_OPCODE_SEND); wqe->ctrl[1] = htonl(txq->qp_num_8s | ds); + wqe->ctrl[2] = 0; + wqe->ctrl[3] = 0; + wqe->eseg.rsvd0 = 0; + wqe->eseg.rsvd1 = 0; + wqe->eseg.mss = 0; + wqe->eseg.rsvd2 = 0; + wqe->eseg.inline_hdr_sz = htons(pkt_inline_sz); + wqe->eseg.inline_hdr[0] = ehdr[0]; + wqe->eseg.inline_hdr[1] = ehdr[1]; txq->wqe_ci += (ds + 3) / 4; #ifdef MLX5_PMD_SOFT_COUNTERS /* Increment sent bytes counter. */ -- 2.1.4