From patchwork Thu Aug 4 15:54:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 15126 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 198F92C37; Thu, 4 Aug 2016 17:54:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 65BA2914 for ; 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 ; 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 ; 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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;