From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0071.outbound.protection.outlook.com [104.47.34.71]) by dpdk.org (Postfix) with ESMTP id 278D8FFA for ; Tue, 12 Sep 2017 17:06:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ALuALUYOiMTb/MTsJtvpjozGQeLd9Bg55HZteGOuSzA=; b=A9JZdUp9/vdtUE7jgmXaZ9/8QvzYfQdAh7eb/lI5I7FudPQInJvBywnDcg+5p6Qp/eWP09FJUFTFei5C7eJZIogZRk9ySyFA/0vGCGfM4jxMKXQ+TtmxUfseALZjd1QtkqF27PoGN8+EpBkqRt3Hxo5fpzgnO/XNWjKOv1Y1sfM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Tue, 12 Sep 2017 15:06:54 +0000 From: Pavan Nikhilesh To: reshma.pattan@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 12 Sep 2017 20:36:04 +0530 Message-Id: <1505228764-9738-2-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505228764-9738-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1505228764-9738-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0106.INDPRD01.PROD.OUTLOOK.COM (10.174.144.22) To CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d53ab1f0-dcc7-4b77-34d7-08d4f9efe871 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR07MB3464; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 3:YmNYWE8McCpPFfp2rm0cWkMwuSS6iNS1Sc2lIOFWJRu1ZhGe55xKMN8eB/lSdDf2hf98KAnMuoVyk3SYYJUWFzsW5KJfLvszxFQAicSI43lYJXWQiXv738+0AsDJ/BnP/jsUHSyChcK2WK8dwamrV+UIaYY4pM4g/9PcE236DVD/0MOjLyFqDIPvZ0SDi7HqbH54hBfyf/f0M3W1P5yKmaAjXSKJYEwSR59pyuKVOsLSCsPgF1ZBjQjTxXN7tFA+; 25:qoaiNIN9ktkG+H4g9z5GVLV6scmrJPSFwa+nML3MCljYKg6XwgzdzSgVPXVFlVnAJo4mI0V8H9t2asca1eShSmC3lD1JabbS/dcbLApcgkfNiEBSjbgn2fJt7Yrbsswif95AQJrtIt+JWHSLnHOPao17HxsEMb1zXSkys+tgZO/aLO2TzVceg/g9mtVAaDhS/mzoVmunHgQpoVxZFjlzj4qyK+2ad0ETPUa78ZDtuiZ7o/oYLDIWoxDAjSX9YALWOk4hetY1V4GhCZy9QOQ7gYSuaJlPX3TsJrM5ERXrgTZJHRPRgL3etWQhSQfo22ppdOIqriSy1YFNcGV9zsMnBg==; 31:1+kEQ5SjV4dwy8PLNL6PQi4C0l/E4ntRzZ+l0CqXSGbG1CYJ50TVOPQAG7AR0lDbx3W9S9EyLE7j+Jok1ySWUJ0qntBqwrclgZrydflH1syrvu5Cz1NG8Z3+a/HUw3hH2Kl71owLLxQZxpjcC5grZ4jD/zBm+nQVD+/7ZJYeM0a6/fJOqkZt4MgzoLBMnrSZgH1pUFEWI+T5ioMAWbUuuUN/gtfTf31fOVW7He4hlWc= X-MS-TrafficTypeDiagnostic: CY4PR07MB3464: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 20:/52fi8Hj4nRG2OLQKrFWuEH2d3yNkiK7KX7P05JLW2DZpFwinSWgvDkeBW5aDK27Jp1Wf3ZeaInk23xNdK0I3a70kX1r3bsEXdLVC7tYgqNhA+Hrm1VzW8xua5ACrlMRLtjGfQh808p/c/dcUyC/pyFBaUG7VwF9RJeIxJRq7nN0xjFYQnEQbxkF9hkiPysgxSrWFIqdfAaLdmpiAl3/RSG3t7jybio7ts81+MIpRWa5vFMcoXArvfQn176SjQW5bRWnxtxRaxdIadJJM7xg54FhihgY43XuJxp98Q37EDnh9LxA/mZnVF2cFWchhXGQSoeZZET1+WR7sU2ql0nivrqfc90dfJvDNZ+RVc4aF3esO297ZLt1zOMq2cir0kmbess+PR18B0+xjjDtuNNv3CLpWvTwejK3WeIWsKChm9epWl3Zplap2hk6sTdaGsFAsb+li4ixf/lcDYmxjgqG1f/WQUSOvY0OWtR8+49bP2HGbE5fF2pdNrrLOTAQiX/ELe2L/bQNpsWjEB+zljTaO6vwgct9qBY38An44djegDzQVkr80swmHez4R2CDX3vjEHExqOgme2vcL9sYZ2NTBzMWH890RSaEnvQXlz16oPg=; 4:ddvuPRNKKzF9edlIShCzyGuzvgcMVCrzfpqQq/FzD7y5cFK4M9R41/2kejr3CdZoUrlMT9spgb+vTc5HJYJBtZ/ichsuSXUH2nBREB0+t+9j8LtX+yd1uMyvy8TLfabaybr8v8Q1rxqzzdmKMoFO5roScHWBroJh8eKaS3lqKVTvDwshldqi6LCTyp7Vuyz6Q5zMEY2zQomiJiu87tmmVjgTrC+liwq4vp37j4DkVifHHqYA5JsXCkmATdc1fdyT X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3464; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3464; X-Forefront-PRVS: 042857DBB5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(575784001)(47776003)(6916009)(2361001)(6666003)(33646002)(2950100002)(2351001)(42882006)(5003940100001)(2906002)(4326008)(50226002)(66066001)(48376002)(68736007)(25786009)(50466002)(53936002)(53416004)(36756003)(105586002)(305945005)(6512007)(106356001)(7736002)(107886003)(110136004)(42186005)(189998001)(8676002)(81166006)(8936002)(81156014)(6486002)(6506006)(5660300001)(76176999)(50986999)(6116002)(72206003)(316002)(97736004)(3846002)(69596002)(101416001)(478600001)(5009440100003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3464; H:PBHAGAVATULA-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3464; 23:NMekzqn+rZCbJfIpqtSUkGOFoxl4YfhY3vJbabPEp?= =?us-ascii?Q?Qr2F0ieSJuGmuBFhoSpkKp+nithWiyxuABhxnuaDSLYrOWmcMPKz/3GG1U4L?= =?us-ascii?Q?mA+RMo5nwE/h7p+LELYr8IPLN2gPdzu9gazVzZX0tpR8UyFa24mnj7eSlZso?= =?us-ascii?Q?8iJG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q6akwNEPyHc88wXHLzF+tyXi8aw0HVbfm7eq4PglaXJ4XclY3CEvmQ99+PmmAYXdO9Bd3OuHUy72cAzCS5Na+q9oRdh99nAYmwkiDo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2017 15:06:54.4253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3464 Subject: [dpdk-dev] [PATCH 2/2] test/reorder: fix reorder drain test 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: , X-List-Received-Date: Tue, 12 Sep 2017 15:06:57 -0000 The reorder drain test fails due to mempool corruption caused by freeing packet buffer twice. Fixes: d0c9b58d7156 ("app/test: new reorder unit test") Signed-off-by: Pavan Nikhilesh --- test/test/test_reorder.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/test/test/test_reorder.c b/test/test/test_reorder.c index 4ec22ac..51c2dcd 100644 --- a/test/test/test_reorder.c +++ b/test/test/test_reorder.c @@ -70,13 +70,15 @@ test_reorder_create(void) TEST_ASSERT((b == NULL) && (rte_errno == EINVAL), "No error on create() with NULL name"); - b = rte_reorder_create("PKT", rte_socket_id(), REORDER_BUFFER_SIZE_INVALID); + b = rte_reorder_create("PKT", rte_socket_id(), + REORDER_BUFFER_SIZE_INVALID); TEST_ASSERT((b == NULL) && (rte_errno == EINVAL), "No error on create() with invalid buffer size param."); b = rte_reorder_create("PKT_RO1", rte_socket_id(), REORDER_BUFFER_SIZE); TEST_ASSERT_EQUAL(b, test_params->b, - "New reorder instance created with already existing name"); + "New reorder instance created with already existing" + " name"); return 0; } @@ -88,8 +90,8 @@ test_reorder_init(void) unsigned int size; /* * The minimum memory area size that should be passed to library is, - * sizeof(struct rte_reorder_buffer) + (2 * size * sizeof(struct rte_mbuf *)); - * Otherwise error will be thrown + * sizeof(struct rte_reorder_buffer) + (2 * size * + * sizeof(struct rte_mbuf *)); Otherwise error will be thrown */ size = 100; @@ -189,15 +191,16 @@ test_reorder_insert(void) for (i = 0; i < size; i++) { ret = rte_reorder_insert(b, bufs[i]); if (ret != 0) { - printf("%s:%d: Error inserting packet with seqn less than size\n", + printf("%s:%d: Error inserting packet with seqn less" + " than size\n", __func__, __LINE__); ret = -1; goto exit; } } - /* early packet - should move mbufs to ready buf and move sequence window - * reorder_seq = 4 + /* early packet - should move mbufs to ready buf and move sequence + * window reorder_seq = 4 * RB[] = {0, 1, 2, 3} * OB[] = {4, NULL, NULL, NULL} */ @@ -208,12 +211,14 @@ test_reorder_insert(void) ret = -1; goto exit; } + i++; /* early packet from current sequence window - full ready buffer */ bufs[5]->seqn = 2 * size; ret = rte_reorder_insert(b, bufs[5]); if (!((ret == -1) && (rte_errno == ENOSPC))) { - printf("%s:%d: No error inserting early packet with full ready buffer\n", + printf("%s:%d: No error inserting early packet with full ready" + " buffer\n", __func__, __LINE__); ret = -1; goto exit; @@ -231,7 +236,7 @@ test_reorder_insert(void) ret = 0; exit: - rte_mempool_put_bulk(p, (void *)bufs, num_bufs); + rte_mempool_put_bulk(p, (void **)&bufs[i], num_bufs - i); rte_reorder_free(b); return ret; } @@ -360,6 +365,13 @@ test_setup(void) return 0; } +static void +test_destroy(void) +{ + rte_mempool_free(test_params->p); + test_params->p = NULL; +} + static struct unit_test_suite reorder_test_suite = { .setup = test_setup, @@ -372,7 +384,8 @@ static struct unit_test_suite reorder_test_suite = { TEST_CASE(test_reorder_insert), TEST_CASE(test_reorder_drain), TEST_CASES_END() - } + }, + .teardown = test_destroy }; static int -- 2.7.4