From patchwork Thu Feb 2 10:34:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?N=C3=A9lio_Laranjeiro?= X-Patchwork-Id: 20121 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 853EBFFA; Thu, 2 Feb 2017 11:35:04 +0100 (CET) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 540C2DE3 for ; Thu, 2 Feb 2017 11:35:03 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id b65so83679798wmf.0 for ; Thu, 02 Feb 2017 02:35:03 -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; bh=s4fqaKH42Hh68cKoEBOdviHrIgUjWHabsLU0znibjcY=; b=uStqrKUD8vEi1/8gWaxJANhPFJ9kYUV706SGNU18qeeS3f3ycEBH6M4I923B7O5SAp l9Dn+SLrz6hg8YOJcL6FkcsecdxkFxPC4F+WeR3MSAR13Bcfp1y8a9y/QYKQAUL+Hrch 9Z9fDDuY+icy+TeqSf+or1Nv+shIWRrJq/tSD4p13W8OQX7b4sQiVpkVZ/MbXLsJUs7H 0hQD0jUnPFohITbnYcFpLCBhgPNuegTLDpr7mM0TXcplnl9cyJnPzC37bVyZapN61hut 8Qev0ZWtLb43dJwEXIti6BxS40N0dS6cLmUHc2YvZccqJYXH5GkYcJILfd1CFMO/qDnB Y08w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=s4fqaKH42Hh68cKoEBOdviHrIgUjWHabsLU0znibjcY=; b=PVW8Z3XaDV86SX6iQtcYsZWonL/uvflCgXxZ9m1Mfpm5HZ8aYPVGw26A8OvCVxmx9M fUxnYyI6NdYNAzX+h6XFsi93TkCCdGe4Rj6yz/XLX1GiQ1ZnhxhxnQJ8tuUDo6vjoo9x hNrc+aadL8VG4Ns2xmV7wbt+iv4ghh3wF3Y3A+zkowDYdgpJBbpZxW6vofaL+HxLlap9 olPzrzwsejQM6s1P6SeSf8RDTYcQdYeKMeXzGELj/51bj4LZ5VxjgeHkB8OriDzhLuV5 HKzmFA9zkmC/QvWTl1Iq4yBCrLbzmKyfxLEnYg3Qd/NjBD+AJ1zP3LArpaLgcfGT1MLk MehA== X-Gm-Message-State: AIkVDXJHZd8QeOk10CKwAilIWymulR0/pkw41r2VT1KikXBkPqIMqUUn9I3DHRKK1BA/yudR X-Received: by 10.223.172.136 with SMTP id o8mr6890569wrc.76.1486031702698; Thu, 02 Feb 2017 02:35:02 -0800 (PST) Received: from ping.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v67sm39053808wrc.45.2017.02.02.02.35.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Feb 2017 02:35:02 -0800 (PST) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Adrien Mazarguil , Yongseok Koh Date: Thu, 2 Feb 2017 11:34:11 +0100 Message-Id: X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH 1/3] net/mlx5: fix Ethernet header re-writing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" First two bytes of the Ethernet header was written twice at the same place. Fixes: b8fe952ec5b6 ("net/mlx5: prepare Tx vectorization") Signed-off-by: Yongseok Koh Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_rxtx.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 94fe747..ffca21c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -386,7 +386,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) unsigned int ds = 0; uintptr_t addr; uint64_t naddr; - uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE; + uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE + 2; uint16_t ehdr; uint8_t cs_flags = 0; #ifdef MLX5_PMD_SOFT_COUNTERS @@ -436,23 +436,27 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; } 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 - 2 - - sizeof(vlan)), - &vlan, sizeof(vlan)); - addr -= sizeof(vlan); - length += sizeof(vlan); + unsigned int len = 2 * ETHER_ADDR_LEN - 2; + + addr += 2; + length -= 2; + /* Copy Destination and source mac address. */ + memcpy((uint8_t *)raw, ((uint8_t *)addr), len); + /* Copy VLAN. */ + memcpy((uint8_t *)raw + len, &vlan, sizeof(vlan)); + /* Copy missing two bytes to end the DSeg. */ + memcpy((uint8_t *)raw + len + sizeof(vlan), + ((uint8_t *)addr) + len, 2); + addr += len + 2; + length -= (len + 2); + } else { + memcpy((uint8_t *)raw, ((uint8_t *)addr) + 2, + MLX5_WQE_DWORD_SIZE); + length -= pkt_inline_sz; + addr += pkt_inline_sz; } /* Inline if enough room. */ if (txq->max_inline != 0) { @@ -467,7 +471,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) * raw starts two bytes before the boundary to * continue the above copy of packet data. */ - raw += MLX5_WQE_DWORD_SIZE - 2; + raw += MLX5_WQE_DWORD_SIZE; room = end - (uintptr_t)raw; if (room > max_inline) { uintptr_t addr_end = (addr + max_inline) &