From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F081DA0679 for ; Thu, 4 Apr 2019 11:38:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AFF937CE2; Thu, 4 Apr 2019 11:38:35 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 4888F7CB0 for ; Thu, 4 Apr 2019 11:38:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2019 02:38:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,308,1549958400"; d="scan'208";a="131377524" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.103]) ([10.237.220.103]) by orsmga008.jf.intel.com with ESMTP; 04 Apr 2019 02:38:31 -0700 To: Shahaf Shuler , wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com Cc: dev@dpdk.org, rasland@mellanox.com, thomas@monjalon.net, ferruh.yigit@intel.com References: <3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com> From: "Burakov, Anatoly" Message-ID: <14b0c009-1a15-86f6-b82b-05eb622551a3@intel.com> Date: Thu, 4 Apr 2019 10:38:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 3/3] app/testpmd: map anonymous memory for eth devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190404093830.uy6zKsDKX-RoOkDKUQj8wozitWCsGoDgKdx3Dr7qfnA@z> On 04-Apr-19 6:14 AM, Shahaf Shuler wrote: > Mempools can be populated with anonymous memory when using command line > parameter --mp-alloc=anon. > > Considering the mempools are going to be used by the net devices, > it is better to DMA map this memory. > > This patch add such mapping now that we have the APIs in place[1]. > > [1] commit c33a675b6276 ("bus: introduce device level DMA memory mapping") > > Signed-off-by: Shahaf Shuler > --- > app/test-pmd/testpmd.c | 65 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index dd449a9859..3ad111a143 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -834,6 +834,63 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) > > return 0; > } > +static void > +dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused, > + struct rte_mempool_memhdr *memhdr, unsigned mem_idx __rte_unused) > +{ > + uint16_t pid = 0; > + int ret; > + > + RTE_ETH_FOREACH_DEV(pid) { > + struct rte_eth_dev *dev = > + &rte_eth_devices[pid]; > + > + ret = rte_dev_dma_unmap(dev->device, memhdr->addr, 0, > + memhdr->len); > + if (ret) { > + TESTPMD_LOG(DEBUG, > + "unable to DMA unmap addr 0x%p " > + "for device %s\n", > + memhdr->addr, dev->data->name); > + } > + } > + ret = rte_extmem_unregister(memhdr->addr, memhdr->len); > + if (ret) { > + TESTPMD_LOG(DEBUG, > + "unable to un-register addr 0x%p\n", memhdr->addr); > + return; No need for a return here. Otherwise, Acked-by: Anatoly Burakov -- Thanks, Anatoly