From patchwork Sat Sep 27 18:41:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wiles, Roger Keith" X-Patchwork-Id: 612 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 38DAC683E; Sat, 27 Sep 2014 20:35:17 +0200 (CEST) Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by dpdk.org (Postfix) with ESMTP id 59B71678C for ; Sat, 27 Sep 2014 20:35:15 +0200 (CEST) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.14.9/8.14.5) with ESMTP id s8RIfgP0013715 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Sat, 27 Sep 2014 11:41:42 -0700 (PDT) Received: from ALA-MBB.corp.ad.wrs.com ([169.254.1.18]) by ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) with mapi id 14.03.0174.001; Sat, 27 Sep 2014 11:41:41 -0700 From: "Wiles, Roger Keith" To: "" Thread-Topic: [PATCH] Function __mempool_get_bulk() returns wrong count. Thread-Index: AQHP2oKtLICv7vWhf0Wg0zJjkh9qrQ== Date: Sat, 27 Sep 2014 18:41:41 +0000 Message-ID: <82107A2E-6373-4A8E-9CDA-10FE18EDEFB6@windriver.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.25.40.166] Content-ID: MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] Function __mempool_get_bulk() returns wrong count. 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When __mempool_get_bulk() grabs entries from the cache it returns zero instead of the number of entries obtained. Plus the stats were increased by the wrong count of objects. Signed-off-by: Keith Wiles Acked-by: Neil Horman --- lib/librte_mempool/rte_mempool.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 299d4d7..6750e78 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -988,9 +988,9 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table, cache->len -= n; - __MEMPOOL_STAT_ADD(mp, get_success, n_orig); + __MEMPOOL_STAT_ADD(mp, get_success, n); - return 0; + return n; ring_dequeue: #endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */ @@ -1004,7 +1004,7 @@ ring_dequeue: if (ret < 0) __MEMPOOL_STAT_ADD(mp, get_fail, n_orig); else - __MEMPOOL_STAT_ADD(mp, get_success, n_orig); + __MEMPOOL_STAT_ADD(mp, get_success, ret); return ret; }