From: "Gujjar, Abhinandan S" <abhinandan.gujjar@intel.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Doherty, Declan" <declan.doherty@intel.com>,
"jerinj@marvell.com" <jerinj@marvell.com>,
"Akhil.goyal@nxp.com" <akhil.goyal@nxp.com>,
"Vangati, Narender" <narender.vangati@intel.com>,
"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
nd <nd@arm.com>
Subject: Re: [dpdk-dev] [v2 2/2] test: add testcase for crypto enqueue callback
Date: Fri, 11 Sep 2020 08:35:13 +0000 [thread overview]
Message-ID: <MWHPR11MB183825E9705CC8535BCE95CEE8240@MWHPR11MB1838.namprd11.prod.outlook.com> (raw)
In-Reply-To: <DBAPR08MB58146BAA32DF11481A46D79F98260@DBAPR08MB5814.eurprd08.prod.outlook.com>
Sure Honnappa.
Thanks
Abhinandan
> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Thursday, September 10, 2020 4:21 AM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; dev@dpdk.org
> Cc: Doherty, Declan <declan.doherty@intel.com>; jerinj@marvell.com;
> Akhil.goyal@nxp.com; Vangati, Narender <narender.vangati@intel.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; nd <nd@arm.com>
> Subject: RE: [v2 2/2] test: add testcase for crypto enqueue callback
>
> <snip>
>
> Hi Abhinandan,
> This test case looks good. I think you could add few negative test
> cases as 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 <abhinandan.gujjar@intel.com>
> > > ---
> > > 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 <rte_cryptodev.h>
> > > #include <rte_cryptodev_pmd.h>
> > > #include <rte_string_fns.h>
> > > +#include <rte_rcu_qsbr.h>
> > >
> > > #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER #include
> > > <rte_cryptodev_scheduler.h> @@ -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 = 1;
> > > + struct rte_rcu_qsbr *qsbr = 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 = &testsuite_params;
> > > + struct rte_cryptodev_info dev_info;
> > > + struct rte_cryptodev_qp_conf qp_conf = {
> > > + .nb_descriptors = MAX_NUM_OPS_INFLIGHT
> > > + };
> > > +
> > > + struct rte_cryptodev_enq_callback *cb;
> > > + uint16_t max_threads = 2;
> > > + uint16_t qp_id = 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 = MAX_NUM_OPS_INFLIGHT;
> > > + qp_conf.mp_session = ts_params->session_mpool;
> > > + qp_conf.mp_session_private = 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 = 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 = rte_rcu_qsbr_get_memsize(max_threads);
> > > + qsbr = (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 = {
> > > .suite_name = "Crypto Device Scheduler Unit Test Suite",
> > > .setup = 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
prev parent reply other threads:[~2020-09-11 8:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 7:11 Abhinandan Gujjar
2020-09-09 16:21 ` Gujjar, Abhinandan S
2020-09-09 22:51 ` Honnappa Nagarahalli
2020-09-11 8:35 ` Gujjar, Abhinandan S [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MWHPR11MB183825E9705CC8535BCE95CEE8240@MWHPR11MB1838.namprd11.prod.outlook.com \
--to=abhinandan.gujjar@intel.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=akhil.goyal@nxp.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=konstantin.ananyev@intel.com \
--cc=narender.vangati@intel.com \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).