From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D699A0577; Mon, 13 Apr 2020 11:20:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A95A92A66; Mon, 13 Apr 2020 11:20:29 +0200 (CEST) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 2781D1B53 for ; Mon, 13 Apr 2020 11:20:28 +0200 (CEST) Received: by mail-lj1-f194.google.com with SMTP id r24so8066582ljd.4 for ; Mon, 13 Apr 2020 02:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=uOjzDoa3bHQWjDG5Zz5TDE+Z+dCnzZb7+Y0tX0SpDlA=; b=mEqFe2yYtqR0ltqy6uBZ8pa1eA6zSlcOIQGjSc8cRvWWmUucJxq9Lx4RUhUa6BmNJc oGKe00//LzKKxeOadNemgWW/3bpKAa2PQ3UG8/E49mUJOkijpwMc2bV6+qffTChP7zWA ctx0TOqTTpUjXbPzG2n/aPiDq1s94ezZI2l6geL8J4hPK5mxuQt5CcfKFv51BQpiDu5e Ho1enRFXu6e79ox5Fu8qSvYDyrnIJ6DIfSyvHkngETk4AlQeH7dVwzcqF85woBQB2dUB JRMJdy36qmJs8i88qou3ysJ9d/swvihp1iB8J6/J4Gj4ykBBkQn7rhH97Y+uXp7nDqf4 xCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uOjzDoa3bHQWjDG5Zz5TDE+Z+dCnzZb7+Y0tX0SpDlA=; b=eaD5Hfrl6eYO3cszXrCpLNGAhlqFaMo8HgC6UszeV3bHwRxn9N9VZms+UgINPbxQPK z6YKBzjtCdcODDANcbVXJR1Gmz0vCHSLCLbVLTUE7hp7gLvhfh4Pn5Qot341I5Tw+NNo SqsDXjBtm3jX8VbcwzSmvpUqx++dQw0k6DKrRDcyoSI4CU5kxmAOghpMfiYagdQYfMfC 0Hj8e0UUe1Xc/TTbujUTQe63spSv78FFFm9rX3r1QRVl21zD5cmfmJwHJIEEiIqShQW2 8lp2GXE9118KCMu7fSrGd5JG2hAmddHlG9ElJqTyNrFlp40hz3TFOhsB2N08oNFllCKM UKQw== X-Gm-Message-State: AGi0PuYSCPmg0E/5qe+4gzOSXyA6eqa//apI/WduPOrWJgYlvf12oo9J V3a4UqwquOfNB4AgVwabdNCGWw== X-Google-Smtp-Source: APiQypJQ9yGYrF+ILuSM9LSNZeWxNG5kOig1NoQ76i1c7CRjMUIxbWHiq6cpE72AmiAMrYCuGtNeSQ== X-Received: by 2002:a2e:b610:: with SMTP id r16mr9977468ljn.254.1586769627635; Mon, 13 Apr 2020 02:20:27 -0700 (PDT) Received: from localhost.localdomain ([39.40.57.174]) by smtp.gmail.com with ESMTPSA id n26sm6724376ljg.93.2020.04.13.02.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 02:20:27 -0700 (PDT) From: Sarosh Arif To: david.hunt@intel.com Cc: dev@dpdk.org, Sarosh Arif Date: Mon, 13 Apr 2020 14:19:06 +0500 Message-Id: <20200413091906.782-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] test_distributor.c: prevent memory leakages from the pool 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" rte_mempool_get_bulk is used to get bufs/many_bufs from the pool, but at some locations when test passes/fails the bufs/many_bufs are not returned back to the pool. Due to this, multiple executions of distributor_autotest gives the following error message: Error getting mbufs from pool. To resolve this issue rte_mempool_put_bulk is used whenever the test passes/fails and returns. Signed-off-by: Sarosh Arif --- app/test/test_distributor.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index ba1f81cf8..8608b4ce8 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) printf("Line %d: Error, not all packets flushed. " "Expected %u, got %u\n", __LINE__, BURST, total_packet_count()); + rte_mempool_put_bulk(p, (void *)bufs, BURST); return -1; } @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) printf("Line %d: Error, not all packets flushed. " "Expected %u, got %u\n", __LINE__, BURST, total_packet_count()); + rte_mempool_put_bulk(p, (void *)bufs, BURST); return -1; } @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) printf("Line %d: Error, not all packets flushed. " "Expected %u, got %u\n", __LINE__, BURST, total_packet_count()); + rte_mempool_put_bulk(p, (void *)bufs, BURST); return -1; } @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) if (num_returned != BIG_BATCH) { printf("line %d: Missing packets, expected %d\n", __LINE__, num_returned); + rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH); return -1; } @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) if (j == BIG_BATCH) { printf("Error: could not find source packet #%u\n", i); + rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH); return -1; } } @@ -327,10 +332,12 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p) printf("Line %u: Packet count is incorrect, %u, expected %u\n", __LINE__, total_packet_count(), (1<