From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 41C112BD9 for ; Thu, 3 Mar 2016 15:27:36 +0100 (CET) Received: by mail-wm0-f42.google.com with SMTP id l68so33892819wml.1 for ; Thu, 03 Mar 2016 06:27:36 -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=T3anmDjNIXw5cvTFOtcpDYcdsyTgg3ntPRx8Ca+OgmlaqQ4b7d5Ix9R4LAXyoTSlSS Wyjozmo4qDgkG+ObysSoVoyu3Gepd1SWc82lFhEP4l4+c426m/Gq0JyjWe0zHyTOPbIE B8a72Wx27rrM3OgZK8AUSyIFJeN8Lsn33zVAaTNE2LAqMZ2fqa4irY4Ty8GS7OooNGjd rP3ySFM2wpuLcowVWafadyXWKcE5DKxBibjgyljnbWirAFIHGbwHYRBZb+OZA0wpZbE5 I45u674m8F2hWnYxHUQILF9yHTuRkjM2p6F3TEBJal80zpmof6/9mOL7Fc6jJD9zMVGB +06w== 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=XsE40Axsm57slnZkSBAiSWXNAjhtbqo2WmXmRUp3oH13nQBPiZIB1OtP7K/9nq0uGd cLlRkAb8kVfTq1ifH3HigO9Yf1f+UFNEZfA1hXKm9/zuGnmRrzSO6oK8pQT/ZT8X32Ix Elte0YmX65s6o7yycTJqJOgzj+LH8C+F90/KjSJCkhdElP0fdYgCWjjhI4kt3Kmm4d7Z 4CDD25NiTBwOpKFVPAWQDflQrUMfmyju/BzInR8qi1XyKYAnlfsqQniTFsnYT09zIZej 0LA1fMdh+T4ST5mol/PBmsj/YxXX2g1Q4k/46xAOcxjP4uTo5sPYKyHQpoiwtaqEAIHk 5X1Q== X-Gm-Message-State: AD7BkJK9Erw8r0BYJww4xqdM02BLgHpovw6E9679tlG95gklPhdmNrAJ1U8cB0fkMUa25kj7 X-Received: by 10.194.236.3 with SMTP id uq3mr3280012wjc.119.1457015256104; Thu, 03 Mar 2016 06:27:36 -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 i2sm40908508wje.22.2016.03.03.06.27.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 06:27:35 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 3 Mar 2016 15:27:11 +0100 Message-Id: <1457015237-2993-2-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457015237-2993-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165083-28316-1-git-send-email-adrien.mazarguil@6wind.com> <1457015237-2993-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH v3 1/7] 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: Thu, 03 Mar 2016 14:27:36 -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