From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 68491A045E
	for <public@inbox.dpdk.org>; Wed, 29 May 2019 18:31:45 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 79C951B96B;
	Wed, 29 May 2019 18:31:23 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 83BE71B952
 for <dev@dpdk.org>; Wed, 29 May 2019 18:31:19 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 29 May 2019 09:31:18 -0700
X-ExtLoop1: 1
Received: from silpixa00399498.ir.intel.com (HELO
 silpixa00399498.ger.corp.intel.com) ([10.237.223.125])
 by orsmga005.jf.intel.com with ESMTP; 29 May 2019 09:31:16 -0700
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,
 stephen@networkplumber.org, thomas@monjalon.net, david.marchand@redhat.com
Date: Wed, 29 May 2019 17:30:49 +0100
Message-Id: <f0ca9ec8d6dc7300a94102bdf8935849b1584d16.1559147228.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1559147228.git.anatoly.burakov@intel.com>
References: <cover.1559147228.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1559147228.git.anatoly.burakov@intel.com>
References: <cover.1559147228.git.anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH 03/25] net/mlx4: use new memory locking API
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Replace usages of direct access to shared memory config with
calls to the new API.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/mlx4/mlx4_mr.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c
index 48d458ad4..636d241e3 100644
--- a/drivers/net/mlx4/mlx4_mr.c
+++ b/drivers/net/mlx4/mlx4_mr.c
@@ -593,7 +593,6 @@ mlx4_mr_create_primary(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry,
 		       uintptr_t addr)
 {
 	struct mlx4_priv *priv = dev->data->dev_private;
-	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
 	const struct rte_memseg_list *msl;
 	const struct rte_memseg *ms;
 	struct mlx4_mr *mr = NULL;
@@ -696,7 +695,7 @@ mlx4_mr_create_primary(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry,
 	 * just single page. If not, go on with the big chunk atomically from
 	 * here.
 	 */
-	rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_lock();
 	data_re = data;
 	if (len > msl->page_sz &&
 	    !rte_memseg_contig_walk(mr_find_contig_memsegs_cb, &data_re)) {
@@ -714,7 +713,7 @@ mlx4_mr_create_primary(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry,
 		 */
 		data.start = RTE_ALIGN_FLOOR(addr, msl->page_sz);
 		data.end = data.start + msl->page_sz;
-		rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+		rte_eal_mcfg_mem_read_unlock();
 		mr_free(mr);
 		goto alloc_resources;
 	}
@@ -734,7 +733,7 @@ mlx4_mr_create_primary(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry,
 		DEBUG("port %u found MR for %p on final lookup, abort",
 		      dev->data->port_id, (void *)addr);
 		rte_rwlock_write_unlock(&priv->mr.rwlock);
-		rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+		rte_eal_mcfg_mem_read_unlock();
 		/*
 		 * Must be unlocked before calling rte_free() because
 		 * mlx4_mr_mem_event_free_cb() can be called inside.
@@ -802,12 +801,12 @@ mlx4_mr_create_primary(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry,
 	/* Lookup can't fail. */
 	assert(entry->lkey != UINT32_MAX);
 	rte_rwlock_write_unlock(&priv->mr.rwlock);
-	rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_unlock();
 	return entry->lkey;
 err_mrlock:
 	rte_rwlock_write_unlock(&priv->mr.rwlock);
 err_memlock:
-	rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_unlock();
 err_nolock:
 	/*
 	 * In case of error, as this can be called in a datapath, a warning
-- 
2.17.1