-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
254e82f
commit 9bd9ef6
Showing
7 changed files
with
189 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
*.a | ||
[._]*.sw[a-p] | ||
iokerneld | ||
iokerenld-noht | ||
iokerneld-noht | ||
*~ | ||
.cproject | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#ifdef MLX4 | ||
|
||
#include <mlx4_custom.h> | ||
#define MLX | ||
#define mlx_reg_mem mlx4_manual_reg_mr | ||
#define mlx_dereg_mem mlx4_manual_dereg_mr | ||
|
||
|
||
#elif defined(MLX5) | ||
#include <mlx5_custom.h> | ||
#define MLX | ||
#define mlx_reg_mem mlx5_manual_reg_mr | ||
#define mlx_dereg_mem mlx5_manual_dereg_mr | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
From 970312d4e39fad07a67683e24b0870efd9d7b3e1 Mon Sep 17 00:00:00 2001 | ||
From: Josh Fried <joshuafried@gmail.com> | ||
Date: Thu, 31 Jan 2019 12:53:00 -0500 | ||
Subject: [PATCH] MLX5 support for the iokernel | ||
|
||
--- | ||
config/common_base | 2 +- | ||
drivers/net/mlx5/Makefile | 2 ++ | ||
drivers/net/mlx5/mlx5_custom.h | 8 ++++++++ | ||
drivers/net/mlx5/mlx5_mr.c | 17 +++++++++++++++++ | ||
drivers/net/mlx5/mlx5_mr.h | 2 ++ | ||
drivers/net/mlx5/mlx5_rxtx.h | 22 +++++++--------------- | ||
drivers/net/mlx5/rte_pmd_mlx5_version.map | 4 ++++ | ||
7 files changed, 41 insertions(+), 16 deletions(-) | ||
create mode 100644 drivers/net/mlx5/mlx5_custom.h | ||
|
||
diff --git a/config/common_base b/config/common_base | ||
index d12ae98bc..616b15fed 100644 | ||
--- a/config/common_base | ||
+++ b/config/common_base | ||
@@ -317,7 +317,7 @@ CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS=n | ||
# Compile burst-oriented Mellanox ConnectX-4, ConnectX-5 & Bluefield | ||
# (MLX5) PMD | ||
# | ||
-CONFIG_RTE_LIBRTE_MLX5_PMD=n | ||
+CONFIG_RTE_LIBRTE_MLX5_PMD=y | ||
CONFIG_RTE_LIBRTE_MLX5_DEBUG=n | ||
CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS=n | ||
|
||
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile | ||
index 895cdfeed..a9f25ff5c 100644 | ||
--- a/drivers/net/mlx5/Makefile | ||
+++ b/drivers/net/mlx5/Makefile | ||
@@ -10,6 +10,8 @@ LIB_GLUE = $(LIB_GLUE_BASE).$(LIB_GLUE_VERSION) | ||
LIB_GLUE_BASE = librte_pmd_mlx5_glue.so | ||
LIB_GLUE_VERSION = 18.11.0 | ||
|
||
+SYMLINK-$(CONFIG_RTE_LIBRTE_MLX5_PMD)-include += mlx5_custom.h | ||
+ | ||
# Sources. | ||
SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5.c | ||
ifneq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) | ||
diff --git a/drivers/net/mlx5/mlx5_custom.h b/drivers/net/mlx5/mlx5_custom.h | ||
new file mode 100644 | ||
index 000000000..925721de9 | ||
--- /dev/null | ||
+++ b/drivers/net/mlx5/mlx5_custom.h | ||
@@ -0,0 +1,8 @@ | ||
+ | ||
+#ifndef RTE_PMD_MLX5_CUSTOM_H | ||
+#define RTE_PMD_MLX5_CUSTOM_H | ||
+ | ||
+void *mlx5_manual_reg_mr(uint8_t port_id, void *addr, size_t length, uint32_t *lkey_out); | ||
+void mlx5_manual_dereg_mr(void *ibv_mr); | ||
+ | ||
+#endif /* RTE_PMD_MLX5_CUSTOM_H */ | ||
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c | ||
index 442b2d232..00ef98ab6 100644 | ||
--- a/drivers/net/mlx5/mlx5_mr.c | ||
+++ b/drivers/net/mlx5/mlx5_mr.c | ||
@@ -1368,3 +1368,20 @@ mlx5_mr_release(struct rte_eth_dev *dev) | ||
/* Free all remaining MRs. */ | ||
mlx5_mr_garbage_collect(dev); | ||
} | ||
+ | ||
+void * | ||
+mlx5_manual_reg_mr(uint8_t port_id, void *addr, size_t length, uint32_t *lkey_out) | ||
+{ | ||
+ struct rte_eth_dev *dev = &rte_eth_devices[port_id]; | ||
+ struct priv *priv = dev->data->dev_private; | ||
+ struct ibv_mr *ibv_mr = mlx5_glue->reg_mr(priv->pd, addr, length, IBV_ACCESS_LOCAL_WRITE); | ||
+ if (ibv_mr && lkey_out) *lkey_out = rte_cpu_to_be_32(ibv_mr->lkey); | ||
+ | ||
+ return ibv_mr; | ||
+} | ||
+ | ||
+void | ||
+mlx5_manual_dereg_mr(void *ibv_mr) | ||
+{ | ||
+ mlx5_glue->dereg_mr(ibv_mr); | ||
+} | ||
diff --git a/drivers/net/mlx5/mlx5_mr.h b/drivers/net/mlx5/mlx5_mr.h | ||
index a57003fe9..9db10045e 100644 | ||
--- a/drivers/net/mlx5/mlx5_mr.h | ||
+++ b/drivers/net/mlx5/mlx5_mr.h | ||
@@ -26,6 +26,8 @@ | ||
#include <rte_rwlock.h> | ||
#include <rte_bitmap.h> | ||
|
||
+#include "mlx5_custom.h" | ||
+ | ||
/* Memory Region object. */ | ||
struct mlx5_mr { | ||
LIST_ENTRY(mlx5_mr) mr; /**< Pointer to the prev/next entry. */ | ||
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h | ||
index f47d327cf..18612cc2d 100644 | ||
--- a/drivers/net/mlx5/mlx5_rxtx.h | ||
+++ b/drivers/net/mlx5/mlx5_rxtx.h | ||
@@ -656,6 +656,10 @@ mlx5_rx_addr2mr(struct mlx5_rxq_data *rxq, uintptr_t addr) | ||
|
||
#define mlx5_rx_mb2mr(rxq, mb) mlx5_rx_addr2mr(rxq, (uintptr_t)((mb)->buf_addr)) | ||
|
||
+struct mem_info { | ||
+ uint32_t lkey; | ||
+}; | ||
+ | ||
/** | ||
* Query LKey from a packet buffer for Tx. If not found, add the mempool. | ||
* | ||
@@ -668,22 +672,10 @@ mlx5_rx_addr2mr(struct mlx5_rxq_data *rxq, uintptr_t addr) | ||
* Searched LKey on success, UINT32_MAX on no match. | ||
*/ | ||
static __rte_always_inline uint32_t | ||
-mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb) | ||
+mlx5_tx_mb2mr(struct mlx5_txq_data *txq __rte_unused, struct rte_mbuf *mb) | ||
{ | ||
- struct mlx5_mr_ctrl *mr_ctrl = &txq->mr_ctrl; | ||
- uintptr_t addr = (uintptr_t)mb->buf_addr; | ||
- uint32_t lkey; | ||
- | ||
- /* Check generation bit to see if there's any change on existing MRs. */ | ||
- if (unlikely(*mr_ctrl->dev_gen_ptr != mr_ctrl->cur_gen)) | ||
- mlx5_mr_flush_local_cache(mr_ctrl); | ||
- /* Linear search on MR cache array. */ | ||
- lkey = mlx5_mr_lookup_cache(mr_ctrl->cache, &mr_ctrl->mru, | ||
- MLX5_MR_CACHE_N, addr); | ||
- if (likely(lkey != UINT32_MAX)) | ||
- return lkey; | ||
- /* Take slower bottom-half on miss. */ | ||
- return mlx5_tx_mb2mr_bh(txq, mb); | ||
+ struct mem_info *m = (struct mem_info *)(((char *) mb) + sizeof(struct rte_mbuf)); | ||
+ return m->lkey; | ||
} | ||
|
||
/** | ||
diff --git a/drivers/net/mlx5/rte_pmd_mlx5_version.map b/drivers/net/mlx5/rte_pmd_mlx5_version.map | ||
index ad607bbed..eb819010c 100644 | ||
--- a/drivers/net/mlx5/rte_pmd_mlx5_version.map | ||
+++ b/drivers/net/mlx5/rte_pmd_mlx5_version.map | ||
@@ -1,3 +1,7 @@ | ||
DPDK_2.2 { | ||
local: *; | ||
+ | ||
+ global: | ||
+ mlx5_manual_reg_mr; | ||
+ mlx5_manual_dereg_mr; | ||
}; | ||
-- | ||
2.17.1 | ||
|