From patchwork Fri Nov 24 16:06:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 31647 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2868C236; Fri, 24 Nov 2017 17:07:08 +0100 (CET) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id B434020F for ; Fri, 24 Nov 2017 17:07:06 +0100 (CET) Received: from pure.maildistiller.com (dispatch1.mdlocal [10.7.20.164]) by dispatch1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTP id BBD1F60F55; Fri, 24 Nov 2017 16:07:05 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us3.ppe-hosted.com (us4-filterqueue.mdlocal [10.7.20.246]) by pure.maildistiller.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 3A77A1C0051; Fri, 24 Nov 2017 16:07:05 +0000 (UTC) Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 2AF7FB40090; Fri, 24 Nov 2017 16:07:05 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 24 Nov 2017 08:07:02 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Fri, 24 Nov 2017 08:07:02 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vAOG70Hs019676; Fri, 24 Nov 2017 16:07:00 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vAOG70SB021131; Fri, 24 Nov 2017 16:07:00 GMT From: Andrew Rybchenko To: CC: Olivier Matz , "Artem V. Andreev" Date: Fri, 24 Nov 2017 16:06:29 +0000 Message-ID: <1511539591-20966-5-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> References: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-MDID: 1511539625-FwKOd+461Vu7 Subject: [dpdk-dev] [RFC PATCH 4/6] mempool: add a function to flush default cache 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" From: "Artem V. Andreev" Mempool get/put API cares about cache itself, but sometimes it is required to flush the cache explicitly. Also dedicated API allows to decouple it from block get API (to be added) and provides more fine-grained control. Signed-off-by: Artem V. Andreev Signed-off-by: Andrew Rybchenko --- lib/librte_mempool/rte_mempool.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 9bcb8b7..3a52b93 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -1161,6 +1161,22 @@ rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id) } /** + * Ensure that a default per-lcore mempool cache is flushed, if it is present + * + * @param mp + * A pointer to the mempool structure. + */ +static __rte_always_inline void +rte_mempool_ensure_cache_flushed(struct rte_mempool *mp) +{ + struct rte_mempool_cache *cache; + cache = rte_mempool_default_cache(mp, rte_lcore_id()); + if (cache != NULL && cache->len > 0) + rte_mempool_cache_flush(cache, mp); +} + + +/** * @internal Put several objects back in the mempool; used internally. * @param mp * A pointer to the mempool structure.