From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D1B67C5C6 for ; Wed, 15 Jun 2016 13:47:17 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 15 Jun 2016 04:47:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,475,1459839600"; d="scan'208";a="719417824" Received: from dhunt5-mobl.ger.corp.intel.com (HELO [10.237.220.25]) ([10.237.220.25]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jun 2016 04:47:15 -0700 To: Jan Viktorin References: <1465919341-3209-1-git-send-email-david.hunt@intel.com> <1465976824-83823-1-git-send-email-david.hunt@intel.com> <20160615121358.5ef9f142@pcviktorin.fit.vutbr.cz> Cc: dev@dpdk.org, olivier.matz@6wind.com, jerin.jacob@caviumnetworks.com, shreyansh.jain@nxp.com From: "Hunt, David" Message-ID: <57614043.9090603@intel.com> Date: Wed, 15 Jun 2016 12:47:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160615121358.5ef9f142@pcviktorin.fit.vutbr.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v12 0/3] mempool: add external mempool manager 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, 15 Jun 2016 11:47:18 -0000 On 15/6/2016 11:13 AM, Jan Viktorin wrote: > Hi, > > I've got one last question. Initially, I was interested in creating > my own external memory provider based on a Linux Kernel driver. > So, I've got an opened file descriptor that points to a device which > can mmap a memory regions for me. > > ... > int fd = open("/dev/uio0" ...); > ... > rte_mempool *pool = rte_mempool_create_empty(...); > rte_mempool_set_ops_byname(pool, "uio_allocator_ops"); > > I am not sure how to pass the file descriptor pointer. I thought it would > be possible by the rte_mempool_alloc but it's not... Is it possible > to solve this case? > > The allocator is device-specific. > > Regards > Jan This particular use case is not covered. We did discuss this before, and an opaque pointer was proposed, but did not make it in. http://article.gmane.org/gmane.comp.networking.dpdk.devel/39821 (and following emails in that thread) So, the options for this use case are as follows: 1. Use the pool_data to pass data in to the alloc, then set the pool_data pointer before coming back from alloc. (It's a bit of a hack, but means no code change). 2. Add an extra parameter to the alloc function. The simplest way I can think of doing this is to take the *opaque passed into rte_mempool_populate_phys, and pass it on into the alloc function. This will have minimal impact on the public API,s as there is already an opaque there in the _populate_ funcs, we're just reusing it for the alloc. Do others think option 2 is OK to add this at this late stage? Even if the patch set has already been ACK'd? Regards, Dave.