From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 564995A9C for ; Wed, 1 Jun 2016 15:18:12 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 01 Jun 2016 06:18:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,401,1459839600"; d="scan'208";a="966652533" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 01 Jun 2016 06:18:09 -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 u51DI9nY027510; Wed, 1 Jun 2016 14:18:09 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u51DI939029590; Wed, 1 Jun 2016 14:18:09 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u51DI8PU029585; Wed, 1 Jun 2016 14:18:08 +0100 From: Ferruh Yigit To: dev@dpdk.org Cc: Anatoly Burakov , Olivier Matz , Ferruh Yigit Date: Wed, 1 Jun 2016 14:18:06 +0100 Message-Id: <1464787086-29555-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] ivshmem: add all memzones of mempool to metada 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: , X-List-Received-Date: Wed, 01 Jun 2016 13:18:12 -0000 Mempool consist of multiple memzones, at least from two of them. ivshmem assumes mempool and elements are all in same memzone. Updating code to add all memzones when a mempool added. Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default") Signed-off-by: Ferruh Yigit --- lib/librte_ivshmem/rte_ivshmem.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/librte_ivshmem/rte_ivshmem.c b/lib/librte_ivshmem/rte_ivshmem.c index c8b332c..5c83920 100644 --- a/lib/librte_ivshmem/rte_ivshmem.c +++ b/lib/librte_ivshmem/rte_ivshmem.c @@ -548,25 +548,39 @@ add_ring_to_metadata(const struct rte_ring * r, } static int -add_mempool_to_metadata(const struct rte_mempool * mp, - struct ivshmem_config * config) +add_mempool_memzone_to_metadata(const void *addr, + struct ivshmem_config *config) { - struct rte_memzone * mz; - int ret; + struct rte_memzone *mz; - mz = get_memzone_by_addr(mp); - ret = 0; + mz = get_memzone_by_addr(addr); if (!mz) { RTE_LOG(ERR, EAL, "Cannot find memzone for mempool!\n"); return -1; } - /* mempool consists of memzone and ring */ - ret = add_memzone_to_metadata(mz, config); + return add_memzone_to_metadata(mz, config); +} + +static int +add_mempool_to_metadata(const struct rte_mempool *mp, + struct ivshmem_config *config) +{ + struct rte_mempool_memhdr *memhdr; + int ret; + + ret = add_mempool_memzone_to_metadata(mp, config); if (ret < 0) return -1; + STAILQ_FOREACH(memhdr, &mp->mem_list, next) { + ret = add_mempool_memzone_to_metadata(memhdr->addr, config); + if (ret < 0) + return -1; + } + + /* mempool consists of memzone and ring */ return add_ring_to_metadata(mp->ring, config); } -- 2.5.5