From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 485F4C67C for ; Fri, 29 Jan 2016 11:33:17 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id p63so61881370wmp.1 for ; Fri, 29 Jan 2016 02:33:17 -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; bh=W++DqTnTutv9F85eHLHzemwcMWO0+xj+TBXShaY62vY=; b=v0e3kCKOuJxePw9tJR1Hni7GkQLhe7C6BUkh1ekYy0adC8XyBfKgZx8FMh7LNPUVQP 0xDdTm81FYYZyFG4oXPhB/3FuH74XlaI7QPru9OX++rXgjZT/SbXvh1zX1ZVmEo9U/p4 4toF30oGwoXEG/AKrOCPBTyz7A4Z+EwdNdzLzRsEB+NjTLAE9lyDouD69DU5DyXcYEvJ zXpXt84iXAqSKRMeO3hMi33cMbwdHs6SoHbfjVC7mLUYWN5J6v1lbwCIu/QnZVwFLbeZ jVp4+ELS/MIHGilavIvsVtIp+mU9k+O9PWNTUbo1qIn8cZzgZ87xlOTTLTGp4ObKjGq2 lZUg== 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; bh=W++DqTnTutv9F85eHLHzemwcMWO0+xj+TBXShaY62vY=; b=J6RzSNt7RHx5vrNYsqVnfzrxTcaMzFSYvdAoXbYOJh0O3Ek45+A1FzSUpvuJKDrKHj 52MwQbZ9x5U6RyJpKIqkg5DB29zYMQdpHtETRaDpzMR5/MOIlvlFxFjidkcfUK7Fd63C /ITZH9LKKV+wCpEyKn8oN+uw5ETeElXTCPq5dU8AK9NS6sof1QW2+/oFOQdQGP35TnAi s8T/RzJrRCvbH1mnAHcCBiSBWe++rVAusESFyzy7oeoz/AISq3sIJlGDcioZlhTtH8c9 7mMNBw3RMpRfw+Al8BxsWdlV7mh+MfRffSmVAZ32ugX+LUgx7kGuinuqKPPXk7nmfVFY 2cyg== X-Gm-Message-State: AG10YOQw3P2qvzV0ZXNKiCKdRCjvfVXMXey5Q/en3REV5wMCLtFPUdx/GG8lgePsXwI3cyU9 X-Received: by 10.28.194.69 with SMTP id s66mr8768676wmf.93.1454063597177; Fri, 29 Jan 2016 02:33:17 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id m143sm6806372wma.17.2016.01.29.02.33.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Jan 2016 02:33:16 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 29 Jan 2016 11:32:48 +0100 Message-Id: <1454063573-1993-2-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454063573-1993-1-git-send-email-adrien.mazarguil@6wind.com> References: <1454063573-1993-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 1/6] mlx5: prefetch next TX mbuf header and data 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: Fri, 29 Jan 2016 10:33:17 -0000 From: Nelio Laranjeiro This change improves performance noticeably. Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_rxtx.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 7585570..bee5ce2 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -443,8 +443,11 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) unsigned int i; unsigned int max; int err; + struct rte_mbuf *buf = pkts[0]; assert(elts_comp_cd != 0); + /* Prefetch first packet cacheline. */ + rte_prefetch0(buf); txq_complete(txq); max = (elts_n - (elts_head - txq->elts_tail)); if (max > elts_n) @@ -458,7 +461,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (max > pkts_n) max = pkts_n; for (i = 0; (i != max); ++i) { - struct rte_mbuf *buf = pkts[i]; + struct rte_mbuf *buf_next = pkts[i + 1]; unsigned int elts_head_next = (((elts_head + 1) == elts_n) ? 0 : elts_head + 1); struct txq_elt *elt_next = &(*txq->elts)[elts_head_next]; @@ -481,6 +484,8 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) tmp = next; } while (tmp != NULL); } + if (i + 1 < max) + rte_prefetch0(buf_next); /* Request TX completion. */ if (unlikely(--elts_comp_cd == 0)) { elts_comp_cd = txq->elts_comp_cd_init; @@ -502,6 +507,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) uintptr_t addr; uint32_t length; uint32_t lkey; + uintptr_t buf_next_addr; /* Retrieve buffer information. */ addr = rte_pktmbuf_mtod(buf, uintptr_t); @@ -522,6 +528,13 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) rte_prefetch0((volatile void *) (uintptr_t)addr); RTE_MBUF_PREFETCH_TO_FREE(elt_next->buf); + /* Prefetch next buffer data. */ + if (i + 1 < max) { + buf_next_addr = + rte_pktmbuf_mtod(buf_next, uintptr_t); + rte_prefetch0((volatile void *) + (uintptr_t)buf_next_addr); + } /* Put packet into send queue. */ #if MLX5_PMD_MAX_INLINE > 0 if (length <= txq->max_inline) @@ -571,6 +584,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) #endif /* MLX5_PMD_SGE_WR_N > 1 */ } elts_head = elts_head_next; + buf = buf_next; #ifdef MLX5_PMD_SOFT_COUNTERS /* Increment sent bytes counter. */ txq->stats.obytes += sent_size; -- 2.1.4