From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0055.outbound.protection.outlook.com [104.47.32.55]) by dpdk.org (Postfix) with ESMTP id 22AF45F32 for ; Tue, 9 Oct 2018 09:55:24 +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:X-MS-Exchange-SenderADCheck; bh=LnRdpIXJ9OiSEHd7HYuMxcdOMs+5cJ/vAMN3GQzCS60=; b=CWuWs818tQdR6zK8vYkmoe5GDhnczukpgHpzJ7cGozjmMj9dtr2vE4ZMgOEYhiTVNSWXVChOgK/4gB9ht3ZIS/5/GzL8u0eaohQKyeRtCpDxOwGHXaVZvuRDFpuwQyAsAH631H/RkdplXU3ho3O95K4YjIA7XCkfDi1qWmkq1FY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vivek.Sharma@cavium.com; Received: from dell-e5540.Dlink (119.82.92.140) by BN7PR07MB5380.namprd07.prod.outlook.com (2603:10b6:408:2e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Tue, 9 Oct 2018 07:55:21 +0000 From: Vivek Sharma To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Vivek Sharma Date: Tue, 9 Oct 2018 13:24:59 +0530 Message-Id: <1539071699-29963-3-git-send-email-vivek.sharma@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539071699-29963-1-git-send-email-vivek.sharma@caviumnetworks.com> References: <1539071699-29963-1-git-send-email-vivek.sharma@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [119.82.92.140] X-ClientProxiedBy: BMXPR01CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::34) To BN7PR07MB5380.namprd07.prod.outlook.com (2603:10b6:408:2e::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 70364575-68a4-40a1-a74b-08d62dbc912a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB5380; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB5380; 3:QjEOJIUDwDRuc+N6TSStkvHSdBBV9/WH5dxvlRblEpX/PzS4vGPgiuMNlcK0+QdVsaQY5fHVE21q5RE6rUwZL5/oPDCti2q9ExTlFBZOnvjLlYVZTxXsAMhm1ttuRDWlJNBImSNJwKAhfX/jrVLUqXUv5YMz4+UVFxRc1zBLcZFdT9RcEigeTvp+HPLCx/MtnWwaNPdn+UBfwJAgb99MdkF+bJ+WDIv6cPD4DdctSXqwgTDVupJv5S1oP0Alz4Gj; 25:Xf70ew+EtRE/v2a+nbM/4+h/3Veb/xd+3kZ5PcNJhU0CeUN2XXhf3oylpZwJ8M0Zlcjw9eZ3AssGfyEB3Hmb0ps+h+ZH5hO+5FVkpWKrb8WpxxLv8Pjr+OX33yk/m1+0Cid5aYF1BpFZIaaXpHh5Wnx7coZhDrApxQ+SixaG+iB2buISVemLUGk7MPVQ5O1X0XITfo3OyWIsgL2xE03wORLk+rbRLiyxxYLv4Ep8emPQIEDxa1EuBGSklBl02Itfodei+RDT92RVdJLDCp7a523+OKbThpOFMeouSZj9cIA1QfhLwri/Es8+HkIUR3bhNSgl9pKrNGHVFx0oVD7V/Q==; 31:1Z1mkFAN/qMRXX65VG2iPbjCEAveDN2Ri4r6HknVSNd1qf+DjJPLzzLd48QxciRDjb5uIu1tEdtsLVc3bmQCcGu6ZzgzpawNDLxOfDK9qm/YIyIzsv6v5pXRPcDw7HEiV6NQ3C3qt/kqns8kXjX5FBfTpUpvuY3RnvZigMmPrDatSm3fu22XupJlPpJMr2WscEnD5A6bLO5bolqqJS/ILAydYBKJS1KSbPfRiU+n1Bw= X-MS-TrafficTypeDiagnostic: BN7PR07MB5380: X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB5380; 20:/+QPtUfqHoj2JE5XUJfNfpC+eRgfWPp2Cu6rSg0xqzCE7uf1WLvOj5KdD33amFJa6UMUkqhmQbtZHz3apDfhFoHErnKzrS8GdCiaCl2x3jWOH/iFyvFrkr/29AnljTGSEn3pyG+Nq8YNTVVzgaFiIsLwj3ZcBuHLXIjGduisjGvUraLHrqm7uCXBpgfboSyfcfyeQbVbePAzzqdKzDOR367PaVi2k7QVW72NLkR7WZvbGcg5znaULWNY/P+t4vHKIQ9FnSPm3BciwTjObf7D1sKtjhx+b5g4D/yw/53aJeKWKnR9cM4K02GjpTlnmms+tdPBJFGCNvxqdy+GFUChU6k4YhVWUzWhd4uNqacAPKuZRwXElI78xBoVtVaM20sBg6DczuVGGd3guPj3gofJSs0VksKYWJ9Zxo1DQKZWcuTCXU2bcV6dif0Aq4sukNhfMK9aERrFcMEpKEannvZ1ib0cx1zCFVCOeMtCz5W60cf2glteL5/bIMZR0BXHAFaF/aJ+v+0NailHcbGKC3TIOI6Z7zUS/p4UYDbLeEDI2PF6eTYhNTm74l54uMJob5xeTJNrHfRjHwBtlYhx+BquQdE4Lrnvpegma/IttuwAY2g=; 4:9j9v9LRQbRvMvXMZ2jvpO7S8UFsWNUeTrdu+602KsdRoGezXmYSXJDLdAJYc0vDglIoqVzFCpFkLGtjXcis839MC98QPwAsmruX8FA6U4RcNIyvktLnuCz9YSiK5e77ttkIXplPlu/6zuQsxWxOEkwDjPpD+I10iy7XRT8hiIYP45WuRoTQzV3sAbMqljbwBMXvdoB5Px/KXNwP+LW7rvjT8Sh5mbL1kOA7wLFL7L0gl8VEa/p87Z9R70RKbnejlVXQC3kyVYypaNlyRCRvZMw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231355)(944501410)(4982022)(52105095)(3002001)(10201501046)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051); SRVR:BN7PR07MB5380; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB5380; X-Forefront-PRVS: 08200063E9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(366004)(39860400002)(199004)(189003)(2361001)(53936002)(42882007)(50226002)(107886003)(81166006)(68736007)(14444005)(72206003)(8676002)(6116002)(47776003)(97736004)(6486002)(6512007)(6306002)(16526019)(26005)(3846002)(575784001)(8936002)(81156014)(186003)(25786009)(6916009)(305945005)(7736002)(478600001)(48376002)(2351001)(105586002)(2906002)(4326008)(50466002)(6666003)(36756003)(16586007)(2616005)(52116002)(51416003)(6506007)(5660300001)(11346002)(486006)(476003)(44832011)(316002)(386003)(956004)(76176011)(66066001)(106356001)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB5380; H:dell-e5540.Dlink; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN7PR07MB5380; 23:n0GfIxcw7exQPW1sT5Pf3/bSaMlIAbb+KjcsfSCgQ?= =?us-ascii?Q?NIj1lyJYgS5kiyRafvhKfITtP9xQVzR9oHKD/4hpjrO3+FbV43FJ9o1fa4RH?= =?us-ascii?Q?cTp7iASXIa+oN40KDAGZqLeSl7pM8InHIMBvtNg2Bl/ekCPqHsrh3CDJi4o8?= =?us-ascii?Q?0zlyFSuDeUrlMh5fDXW9B85rYvEHF7hEacbOK1sqcL8eU2sYj5nScR+0xubD?= =?us-ascii?Q?L5cVv3pkxxs/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6fC67LRKCfi9eI?= =?us-ascii?Q?MDeGDlmKwGGHeat8tiCDQIB+E6jtPd9tmvOIc0F/7GIVTgN8WvJqZYWBf6Ag?= =?us-ascii?Q?85kchP8vJvg48zn8oij01N7ELBZ9ml8P/xRAejeTTPjpAQNjnqXmPYoIf0Fx?= =?us-ascii?Q?9LwbQURpsRxdGlVT0ZzAKIBt59Ek+rjGa98IlhOqoodPOHV0XBsF8su9xg4X?= =?us-ascii?Q?4VDT4wylQXQxOGT+x4wfubRSWPVtV5ETlheElbk6BAv?= X-Microsoft-Antispam-Message-Info: vUla+r2qtzsO3VQ4/ksj08zavNreDVCShE53l5xWJjKYCgBESsY/sqFxGcNuyokZoJ5E6KyOIygODNEtW4GtctiwLUYf4HBwBeSfHnc+EEQ+SUN81DYG+aBHxOTFwD0bXq6gNbORnMvF9voiRA1w0LlkLW+mgs4NAAU6zmZoRe8HNfSd1oCA9y6GhzaGWy33QpywJliUntYBK3mtlUhV5CBYzG8/xX+lQIvNrV2QIrKJbSQyaebZ09vZka1YPfo8eLuFLL06oWz5Gw6MdDig6/Mlw1z5KHLyJRiM1aDGGjXPXiQ/ZCwORalzTpox8ILoRNG0KtugGx44RyV+1B4ma1mFBwIGwCz26tvQFxzc+JU= X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB5380; 6:2YyQ4+lE8/TZu8RSwVdL/4IFP4I3fqfHmfJMeYBIcLss20IDJZLPHoVV76pXjLisGvsn49wCM5PlnTsncXJmyDRsJOakXIItrQf7THv7Dx4CueQyANbCPUIB9jz38NmdsFTHc6YDNV8PvrVRt0n43KOob2Ry+fbpWeUhrcTUmAGksp0WybFsQTvs69j1EqbHDfCu2kUyfl49O1HwtN3S6YUczLnc7Jw3yOXFx4GacQD4nChfXg/yI3FvLde+jC8VLU+LImfLBmbPavwkAZAuVN/EsVx13hqNTG7g+arqP++yV6hWB0I7gpA1ArhADAYi+x2Lx8A5ea3Kkqq+zzkkxukMjlbfJ7UQhbyl8eQyuna3vGvS4gf5z1TlHGSXWfUJj8qnHjPV5HZrWu6uwCIYtiVFxQxbU6CvFLsdcq3LvxJLCxoUyibRMAbx1cn/EIjR2kQTv3KL1hsH/pFo2xNf9A==; 5:zhRs9rLQ+/fkfDA+h8BrFPP4hpHibGGDlJoiYPcKtvySq8lRqQLAwMaGVqC15aHbyWsSvYxtYeG4gvnY8u1yx7hvMwgplmstwAcNHs9S8pBOpHudCq1QQiMQnZimQBNYDlbFdF7KLl6qATh6TewDzjze0YA+rg/zN2RUcF0wRfM=; 7:hWgYjToExHkNt4kTb018l2yRz01eWBT7/tZmCp82FZsHUzzG0ac0jnoXAPMdP+BggMOBG8cnMBYYxZvitO6+m49FMsqHGisJPu7MVAx65PLTCNqQmYKVYW2hNrqt+NSYZwsFTc+5okNXO8I3dN1ZNKxfQd1ytznReRYTrCA51ogbLiyPHnMhglSCc9dYJJWDN5yMngogif+lYmUk5ZLl6zpdGJm56bt3R6x18JLDmyWLzSjN6G8Ai92PG8Sh1c4V SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2018 07:55:21.8815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70364575-68a4-40a1-a74b-08d62dbc912a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB5380 Subject: [dpdk-dev] [PATCH 2/2] test/bitmap: implement reverse bitmap scan 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, 09 Oct 2018 07:55:24 -0000 This patch implements support for testing bitmap reverse scan. Bits in bitmap are changed to be an exact multiple of slab size. Signed-off-by: Vivek Sharma --- Prerequisite: * Note that this patchset is dependent on patch: 'http://patches.dpdk.org/patch/45307/' test/test/test_bitmap.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c index 95c5184..21a193b 100644 --- a/test/test/test_bitmap.c +++ b/test/test/test_bitmap.c @@ -11,7 +11,7 @@ #include "test.h" -#define MAX_BITS 1000 +#define MAX_BITS 1024 static int test_bitmap_scan_operations(struct rte_bitmap *bmp) @@ -74,6 +74,72 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp) } static int +test_bitmap_scan_reverse_operations(struct rte_bitmap *bmp) +{ + uint32_t pos = 0; + uint64_t slab1_magic = 0xBADC0FFEEBADF00D; + uint64_t slab2_magic = 0xFEEDDEADDEADF00D; + uint64_t out_slab = 0; + + rte_bitmap_reset(bmp); + + rte_bitmap_set_slab(bmp, MAX_BITS - RTE_BITMAP_SLAB_BIT_SIZE, + slab2_magic); + rte_bitmap_set_slab(bmp, MAX_BITS - (2 * RTE_BITMAP_SLAB_BIT_SIZE), + slab1_magic); + + if (!rte_bitmap_scan_generic(bmp, &pos, &out_slab, + RTE_BITMAP_REV_SCAN)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab2_magic != out_slab) { + printf("Scan operation sanity failed.\n"); + return TEST_FAILED; + } + + if (!rte_bitmap_scan_generic(bmp, &pos, &out_slab, + RTE_BITMAP_REV_SCAN)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab1_magic != out_slab) { + printf("Scan operation sanity failed.\n"); + return TEST_FAILED; + } + + /* Wrap around */ + if (!rte_bitmap_scan_generic(bmp, &pos, &out_slab, + RTE_BITMAP_REV_SCAN)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab2_magic != out_slab) { + printf("Scan operation wrap around failed.\n"); + return TEST_FAILED; + } + + /* Scan reset check. */ + __rte_bitmap_scan_init_generic(bmp, RTE_BITMAP_REV_SCAN); + + if (!rte_bitmap_scan_generic(bmp, &pos, &out_slab, + RTE_BITMAP_REV_SCAN)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab2_magic != out_slab) { + printf("Scan reset operation failed.\n"); + return TEST_FAILED; + } + + return TEST_SUCCESS; +} + +static int test_bitmap_slab_set_get(struct rte_bitmap *bmp) { uint32_t pos = 0; @@ -176,6 +242,9 @@ test_bitmap(void) if (test_bitmap_scan_operations(bmp) < 0) return TEST_FAILED; + if (test_bitmap_scan_reverse_operations(bmp) < 0) + return TEST_FAILED; + rte_bitmap_free(bmp); rte_free(mem); -- 2.7.4