From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ferruh.yigit@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 65BA2914
 for <dev@dpdk.org>; Thu,  4 Aug 2016 17:54:09 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga104.fm.intel.com with ESMTP; 04 Aug 2016 08:54:08 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,470,1464678000"; d="scan'208";a="150635745"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by fmsmga004.fm.intel.com with ESMTP; 04 Aug 2016 08:54:07 -0700
Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com
 [10.237.217.46])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 u74Fs7SS032326 for <dev@dpdk.org>; Thu, 4 Aug 2016 16:54:07 +0100
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id u74Fs7ql006812
 for <dev@dpdk.org>; Thu, 4 Aug 2016 16:54:07 +0100
Received: (from fyigit@localhost)
 by sivswdev02.ir.intel.com with  id u74Fs7iM006768
 for dev@dpdk.org; Thu, 4 Aug 2016 16:54:07 +0100
X-Authentication-Warning: sivswdev02.ir.intel.com: fyigit set sender to
 ferruh.yigit@intel.com using -f
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Date: Thu,  4 Aug 2016 16:54:05 +0100
Message-Id: <1470326045-6737-1-git-send-email-ferruh.yigit@intel.com>
X-Mailer: git-send-email 1.7.4.1
Subject: [dpdk-dev] [PATCH] kni: memzone info not required to get mbuf
	address
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Aug 2016 15:54:09 -0000

Originally mempool->mz is used to get address of the mbuf, but now
address get directly from mempool, so mempool->mz information is not
required.

Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_kni/rte_kni.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 3028fd4..f48b72b 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -321,9 +321,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
 	struct rte_kni_device_info dev_info;
 	struct rte_kni *ctx;
 	char intf_name[RTE_KNI_NAMESIZE];
-	char mz_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz;
-	const struct rte_mempool *mp;
 	struct rte_kni_memzone_slot *slot = NULL;
 
 	if (!pktmbuf_pool || !conf || !conf->name[0])
@@ -416,17 +414,12 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
 
 
 	/* MBUF mempool */
-	snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_MZ_FORMAT,
-		pktmbuf_pool->name);
-	mz = rte_memzone_lookup(mz_name);
-	KNI_MEM_CHECK(mz == NULL);
-	mp = (struct rte_mempool *)mz->addr;
 	/* KNI currently requires to have only one memory chunk */
-	if (mp->nb_mem_chunks != 1)
+	if (pktmbuf_pool->nb_mem_chunks != 1)
 		goto kni_fail;
 
-	dev_info.mbuf_va = STAILQ_FIRST(&mp->mem_list)->addr;
-	dev_info.mbuf_phys = STAILQ_FIRST(&mp->mem_list)->phys_addr;
+	dev_info.mbuf_va = STAILQ_FIRST(&pktmbuf_pool->mem_list)->addr;
+	dev_info.mbuf_phys = STAILQ_FIRST(&pktmbuf_pool->mem_list)->phys_addr;
 	ctx->pktmbuf_pool = pktmbuf_pool;
 	ctx->group_id = conf->group_id;
 	ctx->slot_id = slot->id;
-- 
2.7.4