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 EC4DCA04B5; Thu, 10 Sep 2020 00:51:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 700771BE0C; Thu, 10 Sep 2020 00:51:32 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2085.outbound.protection.outlook.com [40.107.20.85]) by dpdk.org (Postfix) with ESMTP id D954A1B9B7 for ; Thu, 10 Sep 2020 00:51:31 +0200 (CEST) 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=GauFqEeM5PniNnJr8rXGsPoPm8DcjJqNkAQiMcTpR/c=; b=ndY/pN/OBeOuFF2F69iRoDukm+v7KVNf2jM2lUzmJrt05DECaQNeFBBCxZxTL5GXZh5uiXAZG2qiiW/SLv71G4DBkPJGyoT+ljxV2wDrhKBEoEOzE5FOJAISm87uSbz+s6E3pWxuI0u8tSmTrEhGJojHwR4LgDheNkXv7b6kky4= Received: from AM5PR0101CA0009.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::22) by VI1PR0801MB1869.eurprd08.prod.outlook.com (2603:10a6:800:88::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Wed, 9 Sep 2020 22:51:29 +0000 Received: from VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::5a) by AM5PR0101CA0009.outlook.office365.com (2603:10a6:206:16::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Wed, 9 Sep 2020 22:51:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass 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 VE1EUR03FT027.mail.protection.outlook.com (10.152.18.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Wed, 9 Sep 2020 22:51:29 +0000 Received: ("Tessian outbound 7a6fb63c1e64:v64"); Wed, 09 Sep 2020 22:51:29 +0000 X-CR-MTA-TID: 64aa7808 Received: from b9c1dbbf912f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C9FDF051-CB06-43C0-8F22-3C56F8EC6A12.1; Wed, 09 Sep 2020 22:51:24 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b9c1dbbf912f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 09 Sep 2020 22:51:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzGaqzW1u4jodoLg2vmCDLHof3kQue6QvNSkCctS3CWnhVkxWm5SnYLp9cLDn+uI5BvKglU4suN5yc+doFMMZ2oJgBJ/EZdcCSfTBGjMPyptsH06uYBagfE7I40djdRcszxQOOgCo9/yurVfqkThZ/ordWz4or9om8DWtl6v8Q+iYU2RqBlFxL1mHRhB7TNgWg1xTmO9rpBsSAfbQaT6mze+njAo+/1YbKnsa8PncJ7b6qgPBR73Yy5GKR/dd5zpOThxsb61O2aeohcJe+xGB7hw3u/WiDx4DfeYf2PCEL/hC9fNwtQ09bXKdHCXQWEGR0q+d51aLL0Uz/qYRhRDbg== 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-SenderADCheck; bh=GauFqEeM5PniNnJr8rXGsPoPm8DcjJqNkAQiMcTpR/c=; b=NM2euQH9mQbs3NcxgdMA687WoDHYXOb6DLoEv8Do/afd8nGYrJiWizJpIbKGYDWjyev4UKwdc66pv9mZ4a9q3/39yuDAWCjv2EVKnjqdMAOoMqvjUtqnEIuYVxzdZ88R1uWorFFGqpesxq2FA5J6Tbwy/HYqvfPSN/1L31PByrcauPn1bmCuXCNvq7X/FGv4Djdsj/Qppm5XOdHaVkMUMGBnk/TBTkpIYDZp86ODVIDLGci5vFY3WWE/yqVXO6hmJiV8tHfck1EeakI+X/eS6s7nwmCOSNVaVDhGdMOS/1RWW97CSdLT/1npnMblTM5pIMqxIvzysWL0dtFhgK2cLQ== 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=GauFqEeM5PniNnJr8rXGsPoPm8DcjJqNkAQiMcTpR/c=; b=ndY/pN/OBeOuFF2F69iRoDukm+v7KVNf2jM2lUzmJrt05DECaQNeFBBCxZxTL5GXZh5uiXAZG2qiiW/SLv71G4DBkPJGyoT+ljxV2wDrhKBEoEOzE5FOJAISm87uSbz+s6E3pWxuI0u8tSmTrEhGJojHwR4LgDheNkXv7b6kky4= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB8PR08MB4956.eurprd08.prod.outlook.com (2603:10a6:10:e0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Wed, 9 Sep 2020 22:51:23 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805%6]) with mapi id 15.20.3348.019; Wed, 9 Sep 2020 22:51:23 +0000 From: Honnappa Nagarahalli To: "Gujjar, Abhinandan S" , "dev@dpdk.org" CC: "Doherty, Declan" , "jerinj@marvell.com" , "Akhil.goyal@nxp.com" , "Vangati, Narender" , "Ananyev, Konstantin" , nd Thread-Topic: [v2 2/2] test: add testcase for crypto enqueue callback Thread-Index: AQHWhsTe1Af8thqYBEWrNgxXpShJpqlgfOrggABsfkA= Date: Wed, 9 Sep 2020 22:51:22 +0000 Message-ID: References: <1599549061-195091-1-git-send-email-abhinandan.gujjar@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 2255B2911923F942AB4066D6CD8C0C85.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [107.77.221.165] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 44517f19-57f4-439e-022f-08d85512e3e3 x-ms-traffictypediagnostic: DB8PR08MB4956:|VI1PR0801MB1869: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3631;OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ti+O1mecGSP50VcFCOxmRJZnCByTe5lLeSYh3lg0udJaxlHWX6n3hh1VtdQA2Ek2v6zPxqxTK5O3DtOiQzVCnLIjzrwCjgC0W/tR5a2rXybC4Ko93CxraY/uIhIIJpeUqVjHA0FpXhPkAncWdHk82O4ySZUcDRRYwrPMr8UPqtMSZLCu+6A4XmRB3vC+DPP4Zj2xBaoiy5na4t1vLsbyVKMYQ9rlvo/yQh88TkEUHkk4acLho1rdpK6aPkU6u6OvjWZBGSl8ePIGvBczt641tcAhrEpwbrALz9Q2snnwEGp4v5TYejmWXZwQOvJzrxhd 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(316002)(83380400001)(76116006)(2906002)(7696005)(26005)(5660300002)(6506007)(55016002)(186003)(66556008)(8676002)(66476007)(66446008)(52536014)(64756008)(86362001)(110136005)(66946007)(8936002)(33656002)(478600001)(9686003)(54906003)(71200400001)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: RRozB/NAA24Cc0Ut4oL4sKz+w3WRVZ6vhiJ063OGXxHr8gh6tMA2RagPji9jPL7dX2u+qMFnE6Fz3QR3/vSYt/gjjwDXIqPKFLkATkvSgp/qLhq0iUK2HjhxNZ4zP0HkLmDHOcTv20nwODafrMpUcQ0GpH2D93FVQAonfenP1BHWjEsVXOmrF4kFQ8xf8dTqZ8KMYTDXFNnVnSIWdEtisC0sUaxVQ9uKFtVr10ZoQwUH/H7M15i0gGdzRfjCuO341G/lcnJ8LECWw6PdJfd26aSI9tXrkrQiljh+G1TCMIAHZpL5TjjRcDBb6Vq2rKijk4vvohHHRA/BtlYHuNail0I3tIwChhZBMh/y27HpMdpune1tlJU9siV8e/KVlH+BkLRDKnbZmYeNT3zjQZ/nSjQddyk/KJl/fmguC8nbYPuQ4BWCFJaTD/YZhB5FzZ4afSFXmxxRG5FROm81KNaTGWEHcHcH1WfpqyplsUM75/JQ+dQgkJDiGHNvcHjLw4fTTsEoOXIyPC90qjtHRTKSC69Ao5wcgB0shYmMw/Jxy+1D9uer0vVPt79agAkppWeqWt6GSdSvLYcniX6k5pGv3scC75PTJp6dHPY09KmEJcu1KQtECpvoNELjw25nUUE1C8pMCFHx1Lyf9qaipQeDlA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4956 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ae566842-e338-40a5-8c7f-08d85512e022 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oKWfEYyaxOsLvL3HeKIY8bXBI9YdSCcDM6BpaVCCmadgXFB15lv8N73ZtHgYkfPgO5KPeVSiPRLtRni0XkhfrKm2bHeCkwjQ+ve+32R6PEQcGKTS7DtROgvgXYoyZrOjZpJIpYvrKCxUBdsFu9eMo+HMzWNlvM//1RmkANm31zaGU2KSPZPkmqYCs/DDap5RqoVuiSG2hqe+hWE9I+wgXAKGOVCjroJ1LgZAnHKnVvq0Tz6bFBGk9v5+SW1jf9cLm8svz5CdgcqTdNe7HGBDbVwsM+4QwVwF3xp5Fs/6Z5+jhhm6FWanJkRmbxOiTPU6K+YLxU1H//64ejUuTP7iQL8iZOuPZBMrhyuSH0g4Jw78hjvZp7FhMzF4EU8+iR0oxM5suNJXx+96zuwjystOyg== 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)(396003)(376002)(136003)(346002)(39860400002)(46966005)(47076004)(5660300002)(81166007)(55016002)(82310400003)(6506007)(478600001)(4326008)(26005)(82740400003)(2906002)(83380400001)(33656002)(356005)(9686003)(7696005)(52536014)(8936002)(110136005)(54906003)(36906005)(316002)(336012)(8676002)(86362001)(70586007)(70206006)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2020 22:51:29.2743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44517f19-57f4-439e-022f-08d85512e3e3 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: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1869 Subject: Re: [dpdk-dev] [v2 2/2] test: add testcase for crypto enqueue callback 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" Hi Abhinandan, This test case looks good. I think you could add few negative test cases a= s well. For ex: removing the call back without registering the RCU. Thanks, Honnappa > > > > The purpose of this testcase is to showcase the cryptodev enqueue > > callback usage with RCU support. > > > > Signed-off-by: Abhinandan Gujjar > > --- > > app/test/test_cryptodev.c | 123 > > +++++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 122 insertions(+), 1 deletion(-) > > > > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c > > index > > 70bf6fe..735f501 100644 > > --- a/app/test/test_cryptodev.c > > +++ b/app/test/test_cryptodev.c > > @@ -17,6 +17,7 @@ > > #include > > #include > > #include > > +#include > > > > #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER #include > > @@ -11889,6 +11890,123 @@ struct > > test_crypto_vector { > > return 0; > > } > > > > +#ifdef RTE_CRYPTODEV_CALLBACKS > > +static uint16_t > > +test_enq_callback(uint16_t dev_id, uint16_t qp_id, struct > > +rte_crypto_op > > **ops, > > + uint16_t nb_ops, void *user_param) { > > + RTE_SET_USED(dev_id); > > + RTE_SET_USED(qp_id); > > + RTE_SET_USED(ops); > > + RTE_SET_USED(user_param); > > + > > + return nb_ops; > > +} > > + > > +/* > > + * Thread using enqueue callback with RCU. > > + */ > > +static int > > +test_enq_callback_rcu_thread(void *arg) { > > + uint16_t thread_id =3D 1; > > + struct rte_rcu_qsbr *qsbr =3D arg; > > + > > + /* Register this thread to report quiescent state */ > > + rte_rcu_qsbr_thread_register(qsbr, thread_id); > > + rte_rcu_qsbr_thread_online(qsbr, thread_id); > > + > > + > > + /* DP thread calls rte_cryptodev_enqueue_burst() and > > + * invokes enqueue callback. > > + */ > > + test_null_burst_operation(); > > + > > + /* Update quiescent state */ > > + rte_rcu_qsbr_quiescent(qsbr, thread_id); > > + > > + rte_rcu_qsbr_thread_offline(qsbr, thread_id); > > + rte_rcu_qsbr_thread_unregister(qsbr, thread_id); > > + > > + return 0; > > +} > > + > > +static int > > +test_enq_callback_setup(void) > > +{ > > + struct crypto_testsuite_params *ts_params =3D &testsuite_params; > > + struct rte_cryptodev_info dev_info; > > + struct rte_cryptodev_qp_conf qp_conf =3D { > > + .nb_descriptors =3D MAX_NUM_OPS_INFLIGHT > > + }; > > + > > + struct rte_cryptodev_enq_callback *cb; > > + uint16_t max_threads =3D 2; > > + uint16_t qp_id =3D 0; > > + struct rte_rcu_qsbr *qsbr; > > + size_t size; > > + > > + /* Stop the device in case it's started so it can be configured */ > > + rte_cryptodev_stop(ts_params->valid_devs[0]); > > + > > + rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); > > + > > + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params- > > >valid_devs[0], > > + &ts_params->conf), > > + "Failed to configure cryptodev %u", > > + ts_params->valid_devs[0]); > > + > > + qp_conf.nb_descriptors =3D MAX_NUM_OPS_INFLIGHT; > > + qp_conf.mp_session =3D ts_params->session_mpool; > > + qp_conf.mp_session_private =3D ts_params->session_priv_mpool; > > + > > + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( > > + ts_params->valid_devs[0], qp_id, &qp_conf, > > + rte_cryptodev_socket_id(ts_params- > > >valid_devs[0])), > > + "Failed test for " > > + "rte_cryptodev_queue_pair_setup: num_inflights " > > + "%u on qp %u on cryptodev %u", > > + qp_conf.nb_descriptors, qp_id, > > + ts_params->valid_devs[0]); > > + > > + cb =3D rte_cryptodev_add_enq_callback(ts_params->valid_devs[0], > > + qp_id, test_enq_callback, NULL); > > + TEST_ASSERT_NOT_NULL(cb, "Failed test to add callback on " > > + "qp %u on cryptodev %u", > > + qp_id, ts_params->valid_devs[0]); > > + > > + /* Create RCU QSBR variable */ > > + size =3D rte_rcu_qsbr_get_memsize(max_threads); > > + qsbr =3D (struct rte_rcu_qsbr *)rte_zmalloc_socket(NULL, size, > > + RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); > > + TEST_ASSERT_NOT_NULL(qsbr, "Failed to allocate memory for > > qsbr"); > > + > > + /* Assign QSBR to cryptodev */ > > + TEST_ASSERT_SUCCESS(rte_cryptodev_rcu_qsbr_add( > > + ts_params->valid_devs[0], qsbr), > > + "Failed to setup RCU QSBR for cryptodev %u", > > + ts_params->valid_devs[0]); > > + > > + TEST_ASSERT_SUCCESS(rte_rcu_qsbr_init(qsbr, max_threads), > > + "RCU QSBR init failed"); > > + > > + /* Launch a thread */ > > + rte_eal_remote_launch(test_enq_callback_rcu_thread, qsbr, > > + rte_get_next_lcore(-1, 1, 0)); > > + > > + /* Wait until reader exited. */ > > + rte_eal_mp_wait_lcore(); > > + > > + TEST_ASSERT_SUCCESS(rte_cryptodev_remove_enq_callback( > > + ts_params->valid_devs[0], qp_id, cb), > > + "Failed test to remove callback on " > > + "qp %u on cryptodev %u", > > + qp_id, ts_params->valid_devs[0]); > > + > > + return TEST_SUCCESS; > > +} > > +#endif > > + > > static struct unit_test_suite cryptodev_scheduler_testsuite =3D { > > .suite_name =3D "Crypto Device Scheduler Unit Test Suite", > > .setup =3D testsuite_setup, > > @@ -11943,7 +12061,10 @@ struct test_crypto_vector { > > test_queue_pair_descriptor_setup), > > TEST_CASE_ST(ut_setup, ut_teardown, > > > > test_device_configure_invalid_queue_pair_ids), > > - > > +#ifdef RTE_CRYPTODEV_CALLBACKS > > + TEST_CASE_ST(ut_setup, ut_teardown, > > + test_enq_callback_setup), > > +#endif > > TEST_CASE_ST(ut_setup, ut_teardown, > > test_multi_session), > > TEST_CASE_ST(ut_setup, ut_teardown, > > -- > > 1.9.1