From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id BF95ACCD8 for ; Fri, 17 Jun 2016 12:37:18 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bDrBa-0004cw-PX; Fri, 17 Jun 2016 12:39:39 +0200 To: Lazaros Koromilas , dev@dpdk.org References: <1466074939-29863-1-git-send-email-l@nofutznetworks.com> <1466074939-29863-4-git-send-email-l@nofutznetworks.com> Cc: Konstantin Ananyev , David Hunt From: Olivier Matz Message-ID: <5763D2D5.3010209@6wind.com> Date: Fri, 17 Jun 2016 12:37:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1466074939-29863-4-git-send-email-l@nofutznetworks.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 3/3] mempool: allow for user-owned mempool caches 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: Fri, 17 Jun 2016 10:37:18 -0000 On 06/16/2016 01:02 PM, Lazaros Koromilas wrote: > The mempool cache is only available to EAL threads as a per-lcore > resource. Change this so that the user can create and provide their own > cache on mempool get and put operations. This works with non-EAL threads > too. This commit introduces the new API calls: > > rte_mempool_cache_create(size, socket_id) > rte_mempool_cache_free(cache) > rte_mempool_cache_flush(cache, mp) > rte_mempool_default_cache(mp, lcore_id) These new functions should be added in the .map file, else it will break the compilation in with shared_lib=y. > Changes the API calls: > > rte_mempool_generic_put(mp, obj_table, n, cache, flags) > rte_mempool_generic_get(mp, obj_table, n, cache, flags) > > The cache-oblivious API calls use the per-lcore default local cache. > > Signed-off-by: Lazaros Koromilas > --- > app/test/test_mempool.c | 94 ++++++++++++++++------ > app/test/test_mempool_perf.c | 70 ++++++++++++++--- > lib/librte_mempool/rte_mempool.c | 66 +++++++++++++++- > lib/librte_mempool/rte_mempool.h | 163 ++++++++++++++++++++++++++++----------- > 4 files changed, 310 insertions(+), 83 deletions(-) > > diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c > index 10d706f..723cd39 100644 > --- a/app/test/test_mempool.c > +++ b/app/test/test_mempool.c > @@ -79,6 +79,9 @@ > printf("test failed at %s():%d\n", __func__, __LINE__); \ > return -1; \ > } while (0) > +#define LOG_ERR() do { \ > + printf("test failed at %s():%d\n", __func__, __LINE__); \ > + } while (0) > I see that the usage of this macro is always like this: LOG_ERR(); ret = -1; goto out; What do you think of having: #define LOG_ERR() do { \ printf("test failed at %s():%d\n", __func__, __LINE__); \ } while (0) #define RET_ERR() do { LOG_ERR(); return -1; } while (0) #define GOTO_ERR() do { LOG_ERR(); ret = -1; goto out; } while (0) Then use GOTO_ERR() when appropriate. It would also factorize the printf.