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 0218FA034F; Wed, 10 Nov 2021 22:26:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8A8D4068B; Wed, 10 Nov 2021 22:26:36 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00061.outbound.protection.outlook.com [40.107.0.61]) by mails.dpdk.org (Postfix) with ESMTP id C55D140683 for ; Wed, 10 Nov 2021 22:26:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ncoq5zbIhKiXjddsTypjrlgu0Bk3G3Y8YIJ6bHklP6U=; b=mHPHjLGRXg/6gq6xTJ31NrIh4KRMdnriMW7RFtLUHI3Y5NyXuIEyWvP2Ym/zg8Yi1yjKVUkUejQ0oxW1rg3o3FUQjQjxtIW7Z1exhVZBcPP/wLY54UqF0JYSlrwbqubP0c/ZTA6M0rBdFGS+nZKMG154QRep7lj7Oz3ViY6qXLI= Received: from AS9P194CA0020.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::20) by PAXPR08MB7123.eurprd08.prod.outlook.com (2603:10a6:102:206::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 21:26:15 +0000 Received: from VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46d:cafe::26) by AS9P194CA0020.outlook.office365.com (2603:10a6:20b:46d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16 via Frontend Transport; Wed, 10 Nov 2021 21:26:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT011.mail.protection.outlook.com (10.152.18.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Wed, 10 Nov 2021 21:26:14 +0000 Received: ("Tessian outbound 2bb1f94ba47e:v108"); Wed, 10 Nov 2021 21:26:14 +0000 X-CR-MTA-TID: 64aa7808 Received: from 0795128cfc42.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F2F635E2-63C0-4797-B4EA-60A8C37CC6DA.1; Wed, 10 Nov 2021 21:26:04 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0795128cfc42.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 10 Nov 2021 21:26:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HVaUq3Pv8/X7pJMerOt0TXeZWYpyrsJj+AUtTy0HR2MImw7MlgWNmPgBQkjzs150bthSTuGYzlCLK3eJ3yQY4s6Wdp2Pr0X3aPyUfIiQ4weVB+qvVZcvOs/p73/2VVkZO+08vW3Z1Z3gD1uon6nIcpETB3xiDey+U8kAYstK7+HysfSUYpDJXIrS3GQ6h4Shk53/H5tAzvoiciGUmymLCjt4i/1Q2s8kDlRclzctPtvWvjSQtY1Vrua7NPutZD4jfn6JRrz5pssTKzIwukDwqbZAdDjmduF4e69SpVQiKNdgyfERRMgBzZ1cmae88qHrb5QkPZ3vWwBHeHwHVn2OAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Ncoq5zbIhKiXjddsTypjrlgu0Bk3G3Y8YIJ6bHklP6U=; b=ParmJv2Txnk0GiAPGDCgVTs2eP+cBa4/SaX24swjIm6Yzgm66BL9NEbEIM5zS783KAhpidWVbirmZyewApvGN+uP0SpVnLbDTXEuPFQjQZa5Ggb2/KPDAtM9aF609xmgVKji6gJHN0kb8gUDx+vwMlT0Z61gaZgseTt9l3CYRRYYiaTX/LwSOVQUi3NCgWkBBszglVh08+QiSWWw1MyUWJkSTEzMDBL7+D52jbnSKBdUTzPfOLMZxr2yZJ8lEVpKAcvQOsBi8cu91armd+OPnC9uN2N2HxFiAx776Kla8vc9lOFP1NgAdlvIoX7BQY5i1VMy8wFV0xA7ai4EtCTGxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ncoq5zbIhKiXjddsTypjrlgu0Bk3G3Y8YIJ6bHklP6U=; b=mHPHjLGRXg/6gq6xTJ31NrIh4KRMdnriMW7RFtLUHI3Y5NyXuIEyWvP2Ym/zg8Yi1yjKVUkUejQ0oxW1rg3o3FUQjQjxtIW7Z1exhVZBcPP/wLY54UqF0JYSlrwbqubP0c/ZTA6M0rBdFGS+nZKMG154QRep7lj7Oz3ViY6qXLI= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB6PR0802MB2551.eurprd08.prod.outlook.com (2603:10a6:4:9f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Wed, 10 Nov 2021 21:25:56 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7%9]) with mapi id 15.20.4690.016; Wed, 10 Nov 2021 21:25:56 +0000 From: Honnappa Nagarahalli To: Joyce Kong , "thomas@monjalon.net" , "david.marchand@redhat.com" , Ruifeng Wang , "konstantin.ananyev@intel.com" , "rsanford@akamai.com" , "erik.g.carrillo@intel.com" , "olivier.matz@6wind.com" , "yipeng1.wang@intel.com" , "sameh.gobriel@intel.com" , "bruce.richardson@intel.com" , "vladimir.medvedkin@intel.com" , "anatoly.burakov@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "jerinj@marvell.com" , "declan.doherty@intel.com" , "ciara.power@intel.com" , "xiaoyun.li@intel.com" , "nicolas.chautru@intel.com" , "maryam.tahhan@intel.com" , "reshma.pattan@intel.com" , "cristian.dumitrescu@intel.com" CC: "dev@dpdk.org" , nd , nd Subject: RE: [PATCH v1 11/12] app/bbdev: use compiler atomics for thread sync Thread-Topic: [PATCH v1 11/12] app/bbdev: use compiler atomics for thread sync Thread-Index: AQHXh4gyNvXDLY+/1ki7RfiNlA060qv941Mw Date: Wed, 10 Nov 2021 21:25:55 +0000 Message-ID: References: <20210802101847.3462-1-joyce.kong@arm.com> <20210802101847.3462-12-joyce.kong@arm.com> In-Reply-To: <20210802101847.3462-12-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: D299EBA5D6923E4186B606D2F1E32E4A.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: e061543b-f650-4306-dd8a-08d9a490b9bc x-ms-traffictypediagnostic: DB6PR0802MB2551:|PAXPR08MB7123: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3513;OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: IEEaufrnM85kJwjhqARR2xJxU+KYOZIoWcFYm9GjWAg9mhp4olJLumh989yRJk7h64wj3vCplgCJvySx+NLpMGG82S+9FoALnLbiUi0s/zKwg8SM5ugbW73sxX49VGcHZFDVzBWrfd7Lp8Y0a9tTnsc1cR3LheP4dXhtGmbM1e0xIR9OVMQwsZPMi0EmdVcCMKyRCeqn1TeowPH2VABZhtH4/s7JnuaWJYXSFQC2lp1CIAtJQSsKCHGUchVGxmrUv97y+U5Svcx/Xj+HGTZtSaSnZ6nvkbZ5uWMU1YFYiJUcmPxNgwYryo2FiEgxKumnNgs5EvPZ80rM/PKb4LZNLRUIsFrk1xI5JRz7PQ9aW1C4KAWHCAUwo+PWH2ndVTbqiplRIKC3TK1nfEOdO6hXcrLWsiR5IureRAHOWZVyvOv6g+FNMHH+Y28dHGb6Qrg4actSy3XyV3plTGPtMcqK+S99Kdx4JJSQR6uZlOdAerOkEOO+XmoMIiChhJgknvwdI/GgJKOGWmG+DiSl37jBcAjzxfSYw2HkCjsF0GiFbpOUh369QL+8bcR6Ipn12c2PnXS9vP91GQbofb3gfQOoOpbVji2UhR8jefU9aftr8DMS7RCNuAsokdiTZGtwYV1XW9J/gQOkYg2BT+z52TSXbFjSQIPDjvLIuuBhe0lIBuvP8o6NYB4Dry372+o22CosW0Ieb7dTQZIi12ti+ZZfXS54Ie2osUntvh39vdNuw9k= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(66476007)(186003)(66556008)(9686003)(38100700002)(76116006)(508600001)(52536014)(122000001)(55016002)(4326008)(30864003)(921005)(38070700005)(86362001)(26005)(5660300002)(33656002)(64756008)(7416002)(7696005)(8676002)(66446008)(6506007)(2906002)(66946007)(71200400001)(8936002)(83380400001)(110136005)(54906003); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2551 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5c626778-b3a6-44d0-6148-08d9a490ae9c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yIG3fyjLUV1wKK/FmvpScV9e4cFO17+BoGr6xTB0GvdON1dcTGFHHxtmbeC8WstA3qqY3c9X9yEUfMbhayR1GBPPlfU9LtxSdyRpthP+Iq+OBadpe7F2mvHbHg3rwTiQBKhtezPLbbOMApUZ2AJILU9L2lcSp/AMkNxF1o4EFTmpMNqjbkqJX0U+PK8p/Tz2ZgPSAi/7TEF2bn5OVf1BVg0VXwdsOfRlwIoMDhHPaAOP2QShgXfBL5lw8zmutFZRHcKGhNpMaMpjR5j2nLFJg8VvyMe7jzgdXCNNxA3ft3SQUzKEKgVxsDfovKeCBGxmrOWbOXOEpzizmX+ML7FZhKqjyoIB966kn4yb+1phSKBU/JKA5TdwAwMuatYzg3gbVoMsA4irLFuTQUTnfiR/+NkvLOC8btr01W44dgdh5+i2CoLnH6zvJ2DiVTNRD5UMARA1yfHhyI+QU3WMfABh/L4MObNVVM6E/Qh9zsscnLmSpZwtWf5sSzvFi98j7IEhz83X1PR/4fwVi7t7jQ7i/F0TxjTUFiJv2TcAxc7x9v5Q0ddL92jU/9OFZup1ZmhRlB6VqKTtMerDxJAlWPzbrHF2BWnTgMR+vRx68XS4r15C23DEIFH7FpcLPuoFtIZJO9+Ci6AyAeeByzOBaLzlSTMuGrfGhuUhwl3c4FiQGHiR9tH3CUHWQepAsXi1vxV6I1QaQxkUY/7FmYD1i8AOWpLxM5DPAj4PYR/N2E/tdPg= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(83380400001)(336012)(6506007)(110136005)(186003)(26005)(356005)(70586007)(4326008)(86362001)(81166007)(30864003)(36860700001)(82310400003)(508600001)(8676002)(7696005)(54906003)(70206006)(9686003)(2906002)(8936002)(316002)(47076005)(921005)(55016002)(52536014)(5660300002)(33656002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 21:26:14.6654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e061543b-f650-4306-dd8a-08d9a490b9bc X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7123 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 > Subject: [PATCH v1 11/12] app/bbdev: use compiler atomics for thread sync There are multiple fields which are getting synchronized. How about the fol= lowing: app/bbdev: use compiler atomics for synchronizing shared data >=20 > Convert rte_atomic usages to compiler atomic built-ins for thread params > sync in bbdev cases. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang Otherwise, looks good Reviewed-by: Honnappa Nagarahalli > --- > app/test-bbdev/test_bbdev_perf.c | 135 ++++++++++++++----------------- > 1 file changed, 59 insertions(+), 76 deletions(-) >=20 > diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test- > bbdev/test_bbdev_perf.c > index 469597b8b3..dc62e16216 100644 > --- a/app/test-bbdev/test_bbdev_perf.c > +++ b/app/test-bbdev/test_bbdev_perf.c > @@ -133,7 +133,7 @@ struct test_op_params { > uint16_t num_to_process; > uint16_t num_lcores; > int vector_mask; > - rte_atomic16_t sync; > + uint16_t sync; > struct test_buffers q_bufs[RTE_MAX_NUMA_NODES][MAX_QUEUES]; > }; >=20 > @@ -148,9 +148,9 @@ struct thread_params { > uint8_t iter_count; > double iter_average; > double bler; > - rte_atomic16_t nb_dequeued; > - rte_atomic16_t processing_status; > - rte_atomic16_t burst_sz; > + uint16_t nb_dequeued; > + int16_t processing_status; > + uint16_t burst_sz; > struct test_op_params *op_params; > struct rte_bbdev_dec_op *dec_ops[MAX_BURST]; > struct rte_bbdev_enc_op *enc_ops[MAX_BURST]; @@ -2594,46 > +2594,46 @@ dequeue_event_callback(uint16_t dev_id, > } >=20 > if (unlikely(event !=3D RTE_BBDEV_EVENT_DEQUEUE)) { > - rte_atomic16_set(&tp->processing_status, TEST_FAILED); > + __atomic_store_n(&tp->processing_status, TEST_FAILED, > +__ATOMIC_RELAXED); > printf( > "Dequeue interrupt handler called for incorrect > event!\n"); > return; > } >=20 > - burst_sz =3D rte_atomic16_read(&tp->burst_sz); > + burst_sz =3D __atomic_load_n(&tp->burst_sz, __ATOMIC_RELAXED); > num_ops =3D tp->op_params->num_to_process; >=20 > if (test_vector.op_type =3D=3D RTE_BBDEV_OP_TURBO_DEC) > deq =3D rte_bbdev_dequeue_dec_ops(dev_id, queue_id, > &tp->dec_ops[ > - rte_atomic16_read(&tp- > >nb_dequeued)], > + __atomic_load_n(&tp->nb_dequeued, > __ATOMIC_RELAXED)], > burst_sz); > else if (test_vector.op_type =3D=3D RTE_BBDEV_OP_LDPC_DEC) > deq =3D rte_bbdev_dequeue_ldpc_dec_ops(dev_id, queue_id, > &tp->dec_ops[ > - rte_atomic16_read(&tp- > >nb_dequeued)], > + __atomic_load_n(&tp->nb_dequeued, > __ATOMIC_RELAXED)], > burst_sz); > else if (test_vector.op_type =3D=3D RTE_BBDEV_OP_LDPC_ENC) > deq =3D rte_bbdev_dequeue_ldpc_enc_ops(dev_id, queue_id, > &tp->enc_ops[ > - rte_atomic16_read(&tp- > >nb_dequeued)], > + __atomic_load_n(&tp->nb_dequeued, > __ATOMIC_RELAXED)], > burst_sz); > else /*RTE_BBDEV_OP_TURBO_ENC*/ > deq =3D rte_bbdev_dequeue_enc_ops(dev_id, queue_id, > &tp->enc_ops[ > - rte_atomic16_read(&tp- > >nb_dequeued)], > + __atomic_load_n(&tp->nb_dequeued, > __ATOMIC_RELAXED)], > burst_sz); >=20 > if (deq < burst_sz) { > printf( > "After receiving the interrupt all operations should be > dequeued. Expected: %u, got: %u\n", > burst_sz, deq); > - rte_atomic16_set(&tp->processing_status, TEST_FAILED); > + __atomic_store_n(&tp->processing_status, TEST_FAILED, > +__ATOMIC_RELAXED); > return; > } >=20 > - if (rte_atomic16_read(&tp->nb_dequeued) + deq < num_ops) { > - rte_atomic16_add(&tp->nb_dequeued, deq); > + if (__atomic_load_n(&tp->nb_dequeued, __ATOMIC_RELAXED) + deq > < num_ops) { > + __atomic_fetch_add(&tp->nb_dequeued, deq, > __ATOMIC_RELAXED); > return; > } >=20 > @@ -2670,7 +2670,7 @@ dequeue_event_callback(uint16_t dev_id, >=20 > if (ret) { > printf("Buffers validation failed\n"); > - rte_atomic16_set(&tp->processing_status, TEST_FAILED); > + __atomic_store_n(&tp->processing_status, TEST_FAILED, > +__ATOMIC_RELAXED); > } >=20 > switch (test_vector.op_type) { > @@ -2691,7 +2691,7 @@ dequeue_event_callback(uint16_t dev_id, > break; > default: > printf("Unknown op type: %d\n", test_vector.op_type); > - rte_atomic16_set(&tp->processing_status, TEST_FAILED); > + __atomic_store_n(&tp->processing_status, TEST_FAILED, > +__ATOMIC_RELAXED); > return; > } >=20 > @@ -2700,7 +2700,7 @@ dequeue_event_callback(uint16_t dev_id, > tp->mbps +=3D (((double)(num_ops * tb_len_bits)) / 1000000.0) / > ((double)total_time / (double)rte_get_tsc_hz()); >=20 > - rte_atomic16_add(&tp->nb_dequeued, deq); > + __atomic_fetch_add(&tp->nb_dequeued, deq, __ATOMIC_RELAXED); > } >=20 > static int > @@ -2738,11 +2738,10 @@ throughput_intr_lcore_ldpc_dec(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - rte_atomic16_clear(&tp->processing_status); > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->processing_status, 0, __ATOMIC_RELAXED); > + __atomic_store_n(&tp->nb_dequeued, 0, __ATOMIC_RELAXED); >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops, > num_to_process); > @@ -2790,17 +2789,15 @@ throughput_intr_lcore_ldpc_dec(void *arg) > * the number of operations is not a multiple of > * burst size. > */ > - rte_atomic16_set(&tp->burst_sz, num_to_enq); > + __atomic_store_n(&tp->burst_sz, num_to_enq, > __ATOMIC_RELAXED); >=20 > /* Wait until processing of previous batch is > * completed > */ > - while (rte_atomic16_read(&tp->nb_dequeued) !=3D > - (int16_t) enqueued) > - rte_pause(); > + rte_wait_until_equal_16(&tp->nb_dequeued, > enqueued, > +__ATOMIC_RELAXED); > } > if (j !=3D TEST_REPETITIONS - 1) > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->nb_dequeued, 0, > __ATOMIC_RELAXED); > } >=20 > return TEST_SUCCESS; > @@ -2835,11 +2832,10 @@ throughput_intr_lcore_dec(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - rte_atomic16_clear(&tp->processing_status); > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->processing_status, 0, __ATOMIC_RELAXED); > + __atomic_store_n(&tp->nb_dequeued, 0, __ATOMIC_RELAXED); >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops, > num_to_process); > @@ -2880,17 +2876,15 @@ throughput_intr_lcore_dec(void *arg) > * the number of operations is not a multiple of > * burst size. > */ > - rte_atomic16_set(&tp->burst_sz, num_to_enq); > + __atomic_store_n(&tp->burst_sz, num_to_enq, > __ATOMIC_RELAXED); >=20 > /* Wait until processing of previous batch is > * completed > */ > - while (rte_atomic16_read(&tp->nb_dequeued) !=3D > - (int16_t) enqueued) > - rte_pause(); > + rte_wait_until_equal_16(&tp->nb_dequeued, > enqueued, > +__ATOMIC_RELAXED); > } > if (j !=3D TEST_REPETITIONS - 1) > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->nb_dequeued, 0, > __ATOMIC_RELAXED); > } >=20 > return TEST_SUCCESS; > @@ -2925,11 +2919,10 @@ throughput_intr_lcore_enc(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - rte_atomic16_clear(&tp->processing_status); > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->processing_status, 0, __ATOMIC_RELAXED); > + __atomic_store_n(&tp->nb_dequeued, 0, __ATOMIC_RELAXED); >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_enc_op_alloc_bulk(tp->op_params->mp, ops, > num_to_process); > @@ -2969,17 +2962,15 @@ throughput_intr_lcore_enc(void *arg) > * the number of operations is not a multiple of > * burst size. > */ > - rte_atomic16_set(&tp->burst_sz, num_to_enq); > + __atomic_store_n(&tp->burst_sz, num_to_enq, > __ATOMIC_RELAXED); >=20 > /* Wait until processing of previous batch is > * completed > */ > - while (rte_atomic16_read(&tp->nb_dequeued) !=3D > - (int16_t) enqueued) > - rte_pause(); > + rte_wait_until_equal_16(&tp->nb_dequeued, > enqueued, > +__ATOMIC_RELAXED); > } > if (j !=3D TEST_REPETITIONS - 1) > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->nb_dequeued, 0, > __ATOMIC_RELAXED); > } >=20 > return TEST_SUCCESS; > @@ -3015,11 +3006,10 @@ throughput_intr_lcore_ldpc_enc(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - rte_atomic16_clear(&tp->processing_status); > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->processing_status, 0, __ATOMIC_RELAXED); > + __atomic_store_n(&tp->nb_dequeued, 0, __ATOMIC_RELAXED); >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_enc_op_alloc_bulk(tp->op_params->mp, ops, > num_to_process); > @@ -3061,17 +3051,15 @@ throughput_intr_lcore_ldpc_enc(void *arg) > * the number of operations is not a multiple of > * burst size. > */ > - rte_atomic16_set(&tp->burst_sz, num_to_enq); > + __atomic_store_n(&tp->burst_sz, num_to_enq, > __ATOMIC_RELAXED); >=20 > /* Wait until processing of previous batch is > * completed > */ > - while (rte_atomic16_read(&tp->nb_dequeued) !=3D > - (int16_t) enqueued) > - rte_pause(); > + rte_wait_until_equal_16(&tp->nb_dequeued, > enqueued, > +__ATOMIC_RELAXED); > } > if (j !=3D TEST_REPETITIONS - 1) > - rte_atomic16_clear(&tp->nb_dequeued); > + __atomic_store_n(&tp->nb_dequeued, 0, > __ATOMIC_RELAXED); > } >=20 > return TEST_SUCCESS; > @@ -3105,8 +3093,7 @@ throughput_pmd_lcore_dec(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq, > num_ops); > TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops); > @@ -3209,8 +3196,7 @@ bler_pmd_lcore_ldpc_dec(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq, > num_ops); > TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops); > @@ -3339,8 +3325,7 @@ throughput_pmd_lcore_ldpc_dec(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq, > num_ops); > TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops); > @@ -3456,8 +3441,7 @@ throughput_pmd_lcore_enc(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_enc_op_alloc_bulk(tp->op_params->mp, ops_enq, > num_ops); > @@ -3547,8 +3531,7 @@ throughput_pmd_lcore_ldpc_enc(void *arg) >=20 > bufs =3D &tp->op_params- > >q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >=20 > - while (rte_atomic16_read(&tp->op_params->sync) =3D=3D SYNC_WAIT) > - rte_pause(); > + rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, > +__ATOMIC_RELAXED); >=20 > ret =3D rte_bbdev_enc_op_alloc_bulk(tp->op_params->mp, ops_enq, > num_ops); > @@ -3731,7 +3714,7 @@ bler_test(struct active_device *ad, > else > return TEST_SKIPPED; >=20 > - rte_atomic16_set(&op_params->sync, SYNC_WAIT); > + __atomic_store_n(&op_params->sync, SYNC_WAIT, > __ATOMIC_RELAXED); >=20 > /* Main core is set at first entry */ > t_params[0].dev_id =3D ad->dev_id; > @@ -3754,7 +3737,7 @@ bler_test(struct active_device *ad, > &t_params[used_cores++], lcore_id); > } >=20 > - rte_atomic16_set(&op_params->sync, SYNC_START); > + __atomic_store_n(&op_params->sync, SYNC_START, > __ATOMIC_RELAXED); > ret =3D bler_function(&t_params[0]); >=20 > /* Main core is always used */ > @@ -3849,7 +3832,7 @@ throughput_test(struct active_device *ad, > throughput_function =3D throughput_pmd_lcore_enc; > } >=20 > - rte_atomic16_set(&op_params->sync, SYNC_WAIT); > + __atomic_store_n(&op_params->sync, SYNC_WAIT, > __ATOMIC_RELAXED); >=20 > /* Main core is set at first entry */ > t_params[0].dev_id =3D ad->dev_id; > @@ -3872,7 +3855,7 @@ throughput_test(struct active_device *ad, > &t_params[used_cores++], lcore_id); > } >=20 > - rte_atomic16_set(&op_params->sync, SYNC_START); > + __atomic_store_n(&op_params->sync, SYNC_START, > __ATOMIC_RELAXED); > ret =3D throughput_function(&t_params[0]); >=20 > /* Main core is always used */ > @@ -3902,29 +3885,29 @@ throughput_test(struct active_device *ad, > * Wait for main lcore operations. > */ > tp =3D &t_params[0]; > - while ((rte_atomic16_read(&tp->nb_dequeued) < > - op_params->num_to_process) && > - (rte_atomic16_read(&tp->processing_status) !=3D > - TEST_FAILED)) > + while ((__atomic_load_n(&tp->nb_dequeued, __ATOMIC_RELAXED) < > + op_params->num_to_process) && > + (__atomic_load_n(&tp->processing_status, > __ATOMIC_RELAXED) !=3D > + TEST_FAILED)) > rte_pause(); >=20 > tp->ops_per_sec /=3D TEST_REPETITIONS; > tp->mbps /=3D TEST_REPETITIONS; > - ret |=3D (int)rte_atomic16_read(&tp->processing_status); > + ret |=3D (int)__atomic_load_n(&tp->processing_status, > __ATOMIC_RELAXED); >=20 > /* Wait for worker lcores operations */ > for (used_cores =3D 1; used_cores < num_lcores; used_cores++) { > tp =3D &t_params[used_cores]; >=20 > - while ((rte_atomic16_read(&tp->nb_dequeued) < > - op_params->num_to_process) && > - (rte_atomic16_read(&tp->processing_status) > !=3D > - TEST_FAILED)) > + while ((__atomic_load_n(&tp->nb_dequeued, > __ATOMIC_RELAXED) < > + op_params->num_to_process) && > + (__atomic_load_n(&tp->processing_status, > __ATOMIC_RELAXED) !=3D > + TEST_FAILED)) > rte_pause(); >=20 > tp->ops_per_sec /=3D TEST_REPETITIONS; > tp->mbps /=3D TEST_REPETITIONS; > - ret |=3D (int)rte_atomic16_read(&tp->processing_status); > + ret |=3D (int)__atomic_load_n(&tp->processing_status, > +__ATOMIC_RELAXED); > } >=20 > /* Print throughput if test passed */ > -- > 2.17.1