DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@mellanox.com>
To: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Cc: Xueming Li <xuemingl@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	 dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/4] net/mlx5: forbid MR registration in secondary process
Date: Mon, 15 Jan 2018 14:54:18 +0800	[thread overview]
Message-ID: <20180115065420.44065-2-xuemingl@mellanox.com> (raw)
In-Reply-To: <20180115065420.44065-1-xuemingl@mellanox.com>

Secondary process are not alloed to access verbs resources, add check to
prevent MR registration in data path.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
 doc/guides/nics/mlx5.rst     | 1 +
 drivers/net/mlx5/mlx5_mr.c   | 3 +++
 drivers/net/mlx5/mlx5_rxtx.h | 3 ---
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index bdc2216c0..4373c7990 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -107,6 +107,7 @@ Limitations
 - Inner RSS for VXLAN frames is not supported yet.
 - Hardware checksum RX offloads for VXLAN inner header are not supported yet.
 - Forked secondary process not supported.
+- Mempools used in secondary process TX have to be initialized in primary process before rte_eth_dev_start().
 - Flow pattern without any specific vlan will match for vlan packets as well:
 
   When VLAN spec is not specified in the pattern, the matching rule will be created with VLAN as a wild card.
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 6b29eed55..3c80fbb89 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -278,6 +278,9 @@ priv_mr_new(struct priv *priv, struct rte_mempool *mp)
 	unsigned int i;
 	struct mlx5_mr *mr;
 
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		rte_panic("Please init mempool before rte_eth_dev_start() in primary process: %s",
+			  mp->name);
 	mr = rte_zmalloc_socket(__func__, sizeof(*mr), 0, mp->socket_id);
 	if (!mr) {
 		DEBUG("unable to configure MR, ibv_reg_mr() failed.");
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 2eb2f0506..18e1d26f3 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -561,9 +561,6 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 		}
 		if (txq->mp2mr[i]->start <= addr &&
 		    txq->mp2mr[i]->end >= addr) {
-			assert(txq->mp2mr[i]->lkey != (uint32_t)-1);
-			assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey) ==
-			       txq->mp2mr[i]->lkey);
 			txq->mr_cache_idx = i;
 			return txq->mp2mr[i]->lkey;
 		}
-- 
2.13.3

  reply	other threads:[~2018-01-15  7:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  6:54 [dpdk-dev] [PATCH 1/4] net/mlx5: revert "fix Memory Region registration" Xueming Li
2018-01-15  6:54 ` Xueming Li [this message]
2018-01-15 15:33   ` [dpdk-dev] [PATCH 2/4] net/mlx5: forbid MR registration in secondary process Nélio Laranjeiro
2018-01-15  6:54 ` [dpdk-dev] [PATCH 3/4] net/mlx5: support mempool of multi-mem segments Xueming Li
2018-01-15 16:29   ` Nélio Laranjeiro
2018-01-15  6:54 ` [dpdk-dev] [PATCH 4/4] net/mlx5: remove MR refcnt Xueming Li
2018-01-16  8:09   ` Nélio Laranjeiro
2018-01-15 15:26 ` [dpdk-dev] [PATCH 1/4] net/mlx5: revert "fix Memory Region registration" Nélio Laranjeiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180115065420.44065-2-xuemingl@mellanox.com \
    --to=xuemingl@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=shahafs@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).