From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F6A24577D; Fri, 9 Aug 2024 22:24:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA18042E74; Fri, 9 Aug 2024 22:24:21 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2087.outbound.protection.outlook.com [40.107.22.87]) by mails.dpdk.org (Postfix) with ESMTP id 5768742DB1 for ; Fri, 9 Aug 2024 22:24:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RBoxTcnZi0NMVlEyaUnMcz5+hqn/ZO351dBFhkGYMvks5YNi8wv7SMz/3U9MlFn7DjCo3l+uImfEWHTaI/tCjVP7zA+6KBHqUVLFo1u9shl82OVCiDBTGBy7/4TNAK2ZggwmOSuff5ISnbggK2Acl8HqynJoUywzIA8zbhoSvvpGvTyvjS4vBUUaRICnLh75NzTWCuebOh2XJkWWALSUfZaGcA3jqy9GqRy9umuXt3jDXGAksCx3rIeKvvGW5CbAQvMG13rtwIFhfWWcFzwLWEfoVAQWetoScdWGHnw5SrFKyOIKhBnbcwpsMpEtlAUqbOYY1NDQKEOpOgcJ6UOETA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pgqb9JEA77f9APhXHTEjz7+NixtL0Wc7nymsW0DjEkk=; b=m2Vji0bQWI4oJOuVVwnPrYJT4Fh2eVIpJ2m6jPn49QMYAkLGq4ZJTq+Q5JaMXKnFT29e+CElHSo8Q+3OsDFbyynFkrLGRKj6MLvAkOixjiKB6ePMwRzhF9IXoIOZHAZu18XH7WDpFThA31ub1kb1gfsVUg+G+aJAkBReHI2Q2zLHykJgKuV3Bi6BmzFRVrHx/vySe6bYO4A1UPRqUJPeztdv1h1u7RT9OiDCiO3k6AOcPhTF+hYAB5iZmNRlKZ5I3YQGWtamQZMoXB17yF6cJ/XqC01w8yOygbMlMrnI4Q0wJBEKxGFz8HzDc+IC4jNlp6a5PLeUOb1YbQOxZWD3vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pgqb9JEA77f9APhXHTEjz7+NixtL0Wc7nymsW0DjEkk=; b=u0fJ0d40fXeI2k4463hDyNrfnnt/VZWFoQWYw/rPxKvkktc+Q63lUgruOzKEiBt/CcwPelJgJqnTM85azrF/+m6iRa9bRkzwQLHJKaUab+RggY7CErKF5t+oLun/Vf9JhgdM/mhnJ4eYTsNg/+Y8RXDt5iHctkCh+Ns3ygfk5+YplZvKkQ25fvt95agKEh6iQKx5nbXO4f5yHaUfk9JlDys6eZYuG4VXAWMJiTCkkblTaj7wi/3tOVsmv1lVqNlzqO8/b8761bv20r5DzRiFim8lnHz5OZMfRZlMjdnWu76fcIzsXLp3w5tKinkFBFCh7DudVZ3c+CwVepepCYRDKA== Received: from DUZPR01CA0167.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b3::8) by AS8PR07MB8249.eurprd07.prod.outlook.com (2603:10a6:20b:378::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15; Fri, 9 Aug 2024 20:24:16 +0000 Received: from DB1PEPF000509FA.eurprd03.prod.outlook.com (2603:10a6:10:4b3:cafe::2) by DUZPR01CA0167.outlook.office365.com (2603:10a6:10:4b3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.17 via Frontend Transport; Fri, 9 Aug 2024 20:24:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DB1PEPF000509FA.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.19 via Frontend Transport; Fri, 9 Aug 2024 20:24:16 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.68) with Microsoft SMTP Server id 15.2.1544.11; Fri, 9 Aug 2024 22:24:15 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id AE9621C006A; Fri, 9 Aug 2024 22:24:15 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Tyler Retzlaff , Stephen Hemminger , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH 4/6] eal: add unit tests for atomic bitset operations Date: Fri, 9 Aug 2024 22:14:38 +0200 Message-ID: <20240809201440.590464-4-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809201440.590464-1-mattias.ronnblom@ericsson.com> References: <20240505073313.118515-1-mattias.ronnblom@ericsson.com> <20240809201440.590464-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509FA:EE_|AS8PR07MB8249:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b907f71-6a08-4e69-75b6-08dcb8b13dda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?B?LzY2V0dNbmxWYURUbkEzUGh2bFY0cThrMzZHZjVpZUZENVNRdE1GSStlazc2?= =?utf-8?B?ZGorcG9uQk1jTnc1YUM3dG15R0pwL0w4bk1nK2V4Y2gxM3I0WXk1akJ0RlJ4?= =?utf-8?B?eDROYzNCaTNOMGxTZDB4YWE5TStIY0tGQ1VGUE1HbTJ0MngzeENHZG00UExX?= =?utf-8?B?ZkFnK05Pb0JERXJRTlV1L3RncUNBUkNBUVZ2Ujl4TGhJYStGcDFWSGlST0xp?= =?utf-8?B?YVhKcEhyajJJL3hJMHA1Si9KSkZsQ09kNGp5cDVFVlFYTmhVNXUvaWdwdGhZ?= =?utf-8?B?U25GWVk2ZWJ0L2QvL1h3emxZTDVrbWhpTDFxOTFuQnEvZzBlMEJOaXlXTVVr?= =?utf-8?B?eEtON1ZLaXFvR2drQjdKOTdzOWhXVU9pbWhEUzh0QWdIT1ZKVlpITDhLOStH?= =?utf-8?B?NGRoZFZKN0dqOHZibys0WU9iZGJFcnZrbmszeDFvdldOckFvL3FscXRmcjZW?= =?utf-8?B?VEw0OFFPSFZjMEhwajVNSm96Z3JxRFVHaWZpZE5mZGs1QlV5dkp3YkFCT3Qx?= =?utf-8?B?TWQyckl4MkRQZDN0cUlUUExaeCtsTitwRExtbnVtM2JCeHk4Wk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kVXhFSGRrZlRMbTdRM0dWZjVWYUdtcWR5b0pz?= =?utf-8?B?UHFhV3NCKzBuMmp3Y29zR2NWR25PZnlnUVJUU3pxWjh1S0kzUGxadW40QnlP?= =?utf-8?B?OWwxMUdVanVmOE9kV1l3RFBPZXFqL3kvc0ZiNythR1RNQmVOVzEvWVNBclVG?= =?utf-8?B?eS9ZNSsvTmpVQmk5TGtzckhGeS9iUldmeS9JcVg0Q05nb1JBbWlRV2R3UGZR?= =?utf-8?B?NlhLQkVpcWh0QUpheGZ4S3J0eDJ0ZlZHRUF6WDdCODhHbkRnWDJZeEFaZ2pj?= =?utf-8?B?ci82dnlueGtZYU5XblM4QWNUMG8rMVdQM2l1NmpaTGlmQ1JUNXkzOFZhU1NV?= =?utf-8?B?ZW9XVkpCeE1nbm5XaG9Rb3Y1Wm04SlY5NW5EU1RkMUZQVWlJQnNrNXpTajhs?= =?utf-8?B?MVdtWmMxQVplcEUyYmRPMmdubGZFcmFNTklhVE9BRnJTQmc9PQ==?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 20:24:16.5279 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b907f71-6a08-4e69-75b6-08dcb8b13dda X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509FA.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8249 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Extend bitset tests to cover the basic operation of the rte_bitset_atomic_*() family of functions. Signed-off-by: Mattias Rönnblom --- app/test/test_bitset.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/app/test/test_bitset.c b/app/test/test_bitset.c index b3496df1c0..32224a1eee 100644 --- a/app/test/test_bitset.c +++ b/app/test/test_bitset.c @@ -222,6 +222,52 @@ test_flip(void) rte_bitset_flip); } +static bool +bitset_atomic_test(const uint64_t *bitset, size_t bit_num) +{ + return rte_bitset_atomic_test(bitset, bit_num, + rte_memory_order_relaxed); +} + +static void +bitset_atomic_set(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_set(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_clear(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_clear(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_flip(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_flip(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_assign(uint64_t *bitset, size_t bit_num, bool bit_value) +{ + rte_bitset_atomic_assign(bitset, bit_num, bit_value, + rte_memory_order_relaxed); +} + +static int +test_atomic_set_clear(void) +{ + return test_set_clear_fun(bitset_atomic_test, bitset_atomic_set, + bitset_atomic_clear); +} + +static int +test_atomic_flip(void) +{ + return test_flip_fun(bitset_atomic_test, bitset_atomic_assign, + bitset_atomic_flip); +} + static ssize_t find(const bool *ary, size_t num_bools, size_t start, size_t len, bool set) { @@ -868,6 +914,8 @@ static struct unit_test_suite bitset_tests = { .unit_test_cases = { TEST_CASE_ST(NULL, NULL, test_set_clear), TEST_CASE_ST(NULL, NULL, test_flip), + TEST_CASE_ST(NULL, NULL, test_atomic_set_clear), + TEST_CASE_ST(NULL, NULL, test_atomic_flip), TEST_CASE_ST(NULL, NULL, test_find), TEST_CASE_ST(NULL, NULL, test_foreach), TEST_CASE_ST(NULL, NULL, test_count), -- 2.34.1