From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by dpdk.org (Postfix) with ESMTP id 3ACB05A06 for ; Mon, 1 Aug 2016 22:45:02 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id u25so8597359qtb.3 for ; Mon, 01 Aug 2016 13:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4E3HVATDUNVj2i455exSLIbduEossoWCHuQ10tIdUMM=; b=V9kJMiPX1iFSFoSfAYgBfqKFQ2lgrFRRMeEZBQumyBB9H0DqzlzXUJNBaXxSgjzepM aTOuzlD+/JrJUwf3hR+cNyFroNjWzxxl4RvqkEAJYY5o2YiJ/sp1oalaH7S9FCFRry24 Khe+9ehDAIQTA2Tn3hcPZnGGIjj6zGEBDVxHHXqE9VnS744DGWApuxEeMvDIiTEN3bLT TH+ddAjxHUMHSDeHsHd7c3hyEoWtgKJFge6mrHx15SnBpyQzOJ3glbP6ca9SFLMGdQ9q RQnINAJdIiDuR60OKB2OrtFNkYIP3tVVPSfDjnldsEKqsPRcybZmAsTGufncJIlEFrrY TOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4E3HVATDUNVj2i455exSLIbduEossoWCHuQ10tIdUMM=; b=TvzJoahThynFXw6EQsjXtFWsXWDvjpUdlJ12poTZZNagVTEBIg+dazgFKJUwzYNrbp C82WnasrwtzIWO324FQWi85LEV1pnWy3IwftwMh+Cy/xAN87fYZQ9CD6oneSIlyEj5la PrYNmwarl+0hQYPb0pKQm+iYJVprtGWpfe7nwCGcvA94LqTRHjZO90k0tM1/4AvIyESk TVnW0R9CWeYRb5VYMp0GRs/8mew5SrBQ2HjjK9fj9uiJQJT7BzXgFMmMym+3GTylb3xb d3wotF3T0/1Qz7xoZ3yNeYKAYrDCQpUKLn1GTy8w2S8nuDR0hxnTYlt0IJxKES/f1erw wIvA== X-Gm-Message-State: AEkoouub4MBjBvNhApoBwKLplL6FTSokWwftFNycdHRaMcquud86/sKMNJcCN5uUxekhuQ== X-Received: by 10.237.60.112 with SMTP id u45mr92396822qte.27.1470084301608; Mon, 01 Aug 2016 13:45:01 -0700 (PDT) Received: from localhost.localdomain ([23.79.237.14]) by smtp.gmail.com with ESMTPSA id i65sm18534359qtb.18.2016.08.01.13.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Aug 2016 13:45:01 -0700 (PDT) From: Robert Sanford X-Google-Original-From: Robert Sanford To: dev@dpdk.org Cc: declan.doherty@intel.com, pablo.de.lara.guarch@intel.com, olivier.matz@6wind.com Date: Mon, 1 Aug 2016 16:42:54 -0400 Message-Id: <1470084176-79932-3-git-send-email-rsanford@akamai.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1470084176-79932-1-git-send-email-rsanford@akamai.com> References: <1470084176-79932-1-git-send-email-rsanford@akamai.com> Subject: [dpdk-dev] [PATCH 2/4] mempool: make cache flush threshold macro public 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: Mon, 01 Aug 2016 20:45:02 -0000 Rename macros that calculate a mempool cache flush threshold, and move them from rte_mempool.c to rte_mempool.h, so that the bonding driver can accurately calculate its mbuf requirements. Signed-off-by: Robert Sanford --- lib/librte_mempool/rte_mempool.c | 8 ++------ lib/librte_mempool/rte_mempool.h | 7 +++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 2e28e2e..cca4843 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -69,10 +69,6 @@ static struct rte_tailq_elem rte_mempool_tailq = { }; EAL_REGISTER_TAILQ(rte_mempool_tailq) -#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5 -#define CALC_CACHE_FLUSHTHRESH(c) \ - ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER)) - /* * return the greatest common divisor between a and b (fast algorithm) * @@ -686,7 +682,7 @@ static void mempool_cache_init(struct rte_mempool_cache *cache, uint32_t size) { cache->size = size; - cache->flushthresh = CALC_CACHE_FLUSHTHRESH(size); + cache->flushthresh = RTE_MEMPOOL_CALC_CACHE_FLUSHTHRESH(size); cache->len = 0; } @@ -762,7 +758,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, /* asked cache too big */ if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE || - CALC_CACHE_FLUSHTHRESH(cache_size) > n) { + RTE_MEMPOOL_CALC_CACHE_FLUSHTHRESH(cache_size) > n) { rte_errno = EINVAL; return NULL; } diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 059ad9e..4323c1b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -263,6 +263,13 @@ struct rte_mempool { #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */ /** + * Calculate the threshold before we flush excess elements. + */ +#define RTE_MEMPOOL_CACHE_FLUSHTHRESH_MULTIPLIER 1.5 +#define RTE_MEMPOOL_CALC_CACHE_FLUSHTHRESH(c) \ + ((typeof(c))((c) * RTE_MEMPOOL_CACHE_FLUSHTHRESH_MULTIPLIER)) + +/** * @internal When debug is enabled, store some statistics. * * @param mp -- 1.7.1