[dpdk-stable] patch 'net/mlx4: optimize Tx external memory registration' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Thu Nov 29 14:20:47 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 75e618f9df8bb4e2135aa48f1004ebd50b38f2dd Mon Sep 17 00:00:00 2001
From: Yongseok Koh <yskoh at mellanox.com>
Date: Thu, 15 Nov 2018 10:29:16 +0000
Subject: [PATCH] net/mlx4: optimize Tx external memory registration

[ upstream commit 1948776360d22ca09754982c7da8c75a032f3325 ]

There's some performance drop due to extra condition checks on the
datapath. Checking for external memory registration should be consolidated
to the existing bottom-half.

Fixes: 31912d992403 ("net/mlx4: support externally allocated static memory")

Signed-off-by: Yongseok Koh <yskoh at mellanox.com>
Acked-by: Shahaf Shuler <shahafs at mellanox.com>
---
 drivers/net/mlx4/mlx4_mr.c   | 28 +++++++++++++++++++++++++++-
 drivers/net/mlx4/mlx4_rxtx.h | 26 ++++++--------------------
 2 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c
index 726788a60..a0094483a 100644
--- a/drivers/net/mlx4/mlx4_mr.c
+++ b/drivers/net/mlx4/mlx4_mr.c
@@ -1043,5 +1043,5 @@ mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t addr)
  *   Searched LKey on success, UINT32_MAX on no match.
  */
-uint32_t
+static uint32_t
 mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t addr)
 {
@@ -1054,4 +1054,30 @@ mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t addr)
 }
 
+/**
+ * Bottom-half of LKey search on Tx. If it can't be searched in the memseg
+ * list, register the mempool of the mbuf as externally allocated memory.
+ *
+ * @param txq
+ *   Pointer to Tx queue structure.
+ * @param mb
+ *   Pointer to mbuf.
+ *
+ * @return
+ *   Searched LKey on success, UINT32_MAX on no match.
+ */
+uint32_t
+mlx4_tx_mb2mr_bh(struct txq *txq, struct rte_mbuf *mb)
+{
+	uintptr_t addr = (uintptr_t)mb->buf_addr;
+	uint32_t lkey;
+
+	lkey = mlx4_tx_addr2mr_bh(txq, addr);
+	if (lkey == UINT32_MAX && rte_errno == ENXIO) {
+		/* Mempool may have externally allocated memory. */
+		return mlx4_tx_update_ext_mp(txq, addr, mlx4_mb2mp(mb));
+	}
+	return lkey;
+}
+
 /**
  * Flush all of the local cache entries.
diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h
index 1be060cda..d7ec4e0c5 100644
--- a/drivers/net/mlx4/mlx4_rxtx.h
+++ b/drivers/net/mlx4/mlx4_rxtx.h
@@ -163,5 +163,5 @@ void mlx4_tx_queue_release(void *dpdk_txq);
 void mlx4_mr_flush_local_cache(struct mlx4_mr_ctrl *mr_ctrl);
 uint32_t mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t addr);
-uint32_t mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t addr);
+uint32_t mlx4_tx_mb2mr_bh(struct txq *txq, struct rte_mbuf *mb);
 uint32_t mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t addr,
 			       struct rte_mempool *mp);
@@ -177,5 +177,5 @@ uint32_t mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t addr,
  *   Memory pool where data is located for given mbuf.
  */
-static struct rte_mempool *
+static inline struct rte_mempool *
 mlx4_mb2mp(struct rte_mbuf *buf)
 {
@@ -226,7 +226,8 @@ mlx4_rx_addr2mr(struct rxq *rxq, uintptr_t addr)
  */
 static __rte_always_inline uint32_t
-mlx4_tx_addr2mr(struct txq *txq, uintptr_t addr)
+mlx4_tx_mb2mr(struct txq *txq, struct rte_mbuf *mb)
 {
 	struct mlx4_mr_ctrl *mr_ctrl = &txq->mr_ctrl;
+	uintptr_t addr = (uintptr_t)mb->buf_addr;
 	uint32_t lkey;
 
@@ -239,21 +240,6 @@ mlx4_tx_addr2mr(struct txq *txq, uintptr_t addr)
 	if (likely(lkey != UINT32_MAX))
 		return lkey;
-	/* Take slower bottom-half (binary search) on miss. */
-	return mlx4_tx_addr2mr_bh(txq, addr);
-}
-
-static __rte_always_inline uint32_t
-mlx4_tx_mb2mr(struct txq *txq, struct rte_mbuf *mb)
-{
-	uintptr_t addr = (uintptr_t)mb->buf_addr;
-	uint32_t lkey = mlx4_tx_addr2mr(txq, addr);
-
-	if (likely(lkey != UINT32_MAX))
-		return lkey;
-	if (rte_errno == ENXIO) {
-		/* Mempool may have externally allocated memory. */
-		lkey = mlx4_tx_update_ext_mp(txq, addr, mlx4_mb2mp(mb));
-	}
-	return lkey;
+	/* Take slower bottom-half on miss. */
+	return mlx4_tx_mb2mr_bh(txq, mb);
 }
 
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 13:11:36.245766408 +0000
+++ 0046-net-mlx4-optimize-Tx-external-memory-registration.patch	2018-11-29 13:11:34.000000000 +0000
@@ -1,14 +1,15 @@
-From 1948776360d22ca09754982c7da8c75a032f3325 Mon Sep 17 00:00:00 2001
+From 75e618f9df8bb4e2135aa48f1004ebd50b38f2dd Mon Sep 17 00:00:00 2001
 From: Yongseok Koh <yskoh at mellanox.com>
 Date: Thu, 15 Nov 2018 10:29:16 +0000
 Subject: [PATCH] net/mlx4: optimize Tx external memory registration
 
+[ upstream commit 1948776360d22ca09754982c7da8c75a032f3325 ]
+
 There's some performance drop due to extra condition checks on the
 datapath. Checking for external memory registration should be consolidated
 to the existing bottom-half.
 
 Fixes: 31912d992403 ("net/mlx4: support externally allocated static memory")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yongseok Koh <yskoh at mellanox.com>
 Acked-by: Shahaf Shuler <shahafs at mellanox.com>


More information about the stable mailing list