DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: nelio.laranjeiro@6wind.com, adrien.mazarguil@6wind.com,
	yskoh@mellanox.com
Cc: dev@dpdk.org, stable@dpdk.org, Xueming Li <xuemingl@mellanox.com>
Subject: [dpdk-dev] [PATCH v2 2/6] net/mlx5: fix secondary process mempool registration
Date: Thu, 25 Jan 2018 18:17:59 +0200	[thread overview]
Message-ID: <0bdcde7f31fcbd74224bea27c3db5fb79d2b3fc0.1516896871.git.shahafs@mellanox.com> (raw)
In-Reply-To: <cover.1516896871.git.shahafs@mellanox.com>

Secondary process is not allowed to register mempools on the flight.

The code will return invalid memory key for such case.

Fixes: 87ec44ce1651 ("net/mlx5: add operations for secondary process")
Cc: stable@dpdk.org

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 doc/guides/nics/mlx5.rst   |  6 +++++-
 drivers/net/mlx5/mlx5_mr.c | 12 ++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index bdc2216c0..2e6d1e45a 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -106,7 +106,11 @@ 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.
+- For secondary process:
+
+  - Forked secondary process not supported.
+  - All mempools must be initialized 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 2776dc700..cb625dc61 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -141,8 +141,16 @@ priv_txq_mp2mr_reg(struct priv *priv, struct mlx5_txq_data *txq,
 	DEBUG("%p: discovered new memory pool \"%s\" (%p)",
 	      (void *)txq_ctrl, mp->name, (void *)mp);
 	mr = priv_mr_get(priv, mp);
-	if (mr == NULL)
-		mr = priv_mr_new(priv, mp);
+	if (mr == NULL) {
+		if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+			DEBUG("Using unregistered mempool 0x%p(%s) in secondary process,"
+			     " please create mempool before rte_eth_dev_start()",
+			     (void *)mp, mp->name);
+			return NULL;
+		} else {
+			mr = priv_mr_new(priv, mp);
+		}
+	}
 	if (unlikely(mr == NULL)) {
 		DEBUG("%p: unable to configure MR, ibv_reg_mr() failed.",
 		      (void *)txq_ctrl);
-- 
2.12.0

  parent reply	other threads:[~2018-01-25 16:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 17:08 [dpdk-dev] [PATCH 0/5] fix Memory region lookups Shahaf Shuler
2018-01-23 17:08 ` [dpdk-dev] [PATCH 1/5] net/mlx5: fix Memory Region cache lookup Shahaf Shuler
2018-01-23 17:08 ` [dpdk-dev] [PATCH 2/5] net/mlx5: fix secondary process mempool registration Shahaf Shuler
2018-01-24  8:14   ` Nélio Laranjeiro
2018-01-24 13:37     ` Shahaf Shuler
2018-01-23 17:08 ` [dpdk-dev] [PATCH 3/5] net/mlx5: assert for un-successful memory registration Shahaf Shuler
2018-01-24  8:15   ` Nélio Laranjeiro
2018-01-23 17:08 ` [dpdk-dev] [PATCH 4/5] net/mlx5: fix memory registration cache last index Shahaf Shuler
2018-01-23 17:08 ` [dpdk-dev] [PATCH 5/5] net/mlx5: fix Memory Region boundary checks Shahaf Shuler
2018-01-25 16:17 ` [dpdk-dev] [PATCH v2 0/6] fix Memory region lookups Shahaf Shuler
2018-01-25 16:17   ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: fix Memory Region cache lookup Shahaf Shuler
2018-01-25 16:17   ` Shahaf Shuler [this message]
2018-01-25 16:18   ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: remove assert un-accessible from secondary process Shahaf Shuler
2018-01-25 16:18   ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: warn for un-successful memory registration Shahaf Shuler
2018-01-25 16:18   ` [dpdk-dev] [PATCH v2 5/6] net/mlx5: fix Memory Region cache last index Shahaf Shuler
2018-01-25 16:18   ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: fix Memory Region boundary checks Shahaf Shuler
2018-01-25 19:06     ` Yongseok Koh
2018-01-25 16:25   ` [dpdk-dev] [PATCH v2 0/6] fix Memory region lookups Shahaf Shuler

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=0bdcde7f31fcbd74224bea27c3db5fb79d2b3fc0.1516896871.git.shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=stable@dpdk.org \
    --cc=xuemingl@mellanox.com \
    --cc=yskoh@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).