From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] test/ipsec: fix test suite setup function
Date: Thu, 17 Jan 2019 10:04:54 +0000 [thread overview]
Message-ID: <8CEF83825BEC744B83065625E567D7C260D4F7FD@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB977258010D904263@irsmsx105.ger.corp.intel.com>
Hi Konstantin,
<snip>
> > > > Subject: [PATCH] test/ipsec: fix test suite setup function
> > > >
> > > > Check for valid crypto_null devices before continuing.
> > > >
> > > > Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > > ---
> > > > test/test/test_ipsec.c | 17 +++++++++++++++--
> > > > 1 file changed, 15 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/test/test/test_ipsec.c b/test/test/test_ipsec.c index
> > > > ff1a1c4..4dfc55b 100644
> > > > --- a/test/test/test_ipsec.c
> > > > +++ b/test/test/test_ipsec.c
> > > > @@ -46,6 +46,8 @@
> > > > #define BURST_SIZE 32
> > > > #define REORDER_PKTS 1
> > > >
> > > > +static int gbl_driver_id;
> > > > +
> > >
> > > Why do you need that global here?
> >
> > test_ipsec.c is based on test_cryptodev.c.
> > gbl_driver_id used to store the ID of the required driver.
>
> Sorry but referencing someone else code is not an answer.
> Why do *you* need it *here*?
The global is not needed.
I have renamed it to driver_id and added it as a local variable where it is used.
> > > > struct user_params {
> > > > enum rte_crypto_sym_xform_type auth;
> > > > enum rte_crypto_sym_xform_type cipher; @@ -218,7 +220,7 @@
> > > > testsuite_setup(void) {
> > > > struct ipsec_testsuite_params *ts_params = &testsuite_params;
> > > > struct rte_cryptodev_info info;
> > > > - uint32_t nb_devs, dev_id;
> > > > + uint32_t i, nb_devs, dev_id;
> > > > size_t sess_sz;
> > > >
> > > > memset(ts_params, 0, sizeof(*ts_params)); @@ -251,7 +253,18 @@
> > > > testsuite_setup(void)
> > > > return TEST_FAILED;
> > > > }
> > > >
> > > > - ts_params->valid_devs[ts_params->valid_dev_count++] = 0;
> > > > + gbl_driver_id = rte_cryptodev_driver_id_get(
> > > > + RTE_STR(CRYPTODEV_NAME_NULL_PMD));
> >
> > These tests only work with the crypto_null PMD's, gbl_driver_id is set to the
> crypto_null PMD id here.
> >
> > > > +
> > > > + /* Create list of valid crypto devs */
> > > > + for (i = 0; i < nb_devs; i++) {
> > > > + rte_cryptodev_info_get(i, &info);
> > > > + if (info.driver_id == gbl_driver_id)
> > > > + ts_params->valid_devs[ts_params->valid_dev_count++]
> > > = i;
> > > > + }
> > >
> > > I think you need to check driver capabilities, instead of relying on driver
> name.
> >
> > I don't think it is necessary to check the driver capabilities.
>
> I still think that the valid way to check supported algorithms is to check device
> capabilities, not the driver name.
In the testsuite_setup() function the parameters for the check_cryptodev_capability() are not setup. They are setup in the test functions of the testsuite.
> > This is how it is done in test_cryptodev.c.
> > I think it makes sense to mirror the test_cryptodev.c implementation.
> >
> > > > +
> > > > + if (ts_params->valid_dev_count < 1)
> > > > + return TEST_FAILED;
> > > >
> > > > /* Set up all the qps on the first of the valid devices found */
> > > > dev_id = ts_params->valid_devs[0];
> > >
> > > If we always use just valid_dev[0] to determine private session
> > > size, why do you keep going though all devs in the loop above?
> >
> > There may be several crypto devs present for example, crypto_aesni_mb0,
> crypto_aseni_mb1, crypto_null0 and crypto_null1.
>
> Yes.
>
> > The valid_dev[] array will contain all devs of the requested type, in this case
> crypto_null0 and crypto_null1.
>
> But we need/use only one.
I will change the code to replace the valid_devs[] with one valid_dev.
> > > Another thing, as I mentioned off-line - later you still use all
> > > vald_devs[] to init
> > > session:
> > > s = rte_cryptodev_sym_session_create(qp->mp_session);
> > > if (s == NULL)
> > > return -ENOMEM;
> > >
> > > /* initiliaze SA crypto session for all supported devices */
> > > for (i = 0; i != devnum; i++) {
> > > rc = rte_cryptodev_sym_session_init(devid[i], s,
> > > ut->crypto_xforms, qp->mp_session_private);
> > > if (rc != 0)
> > > break;
> > > }
> > >
> > > I think we need either to determine max private session size based
> > > on *all* valid_devs[], or just use one device that can do NULL algorithm.
> >
> > The valid_devs[] array only contains crypto_null PMD's The code is
> > using the crypto_null PMD only.
>
> In fact there is no reason to be crypto_null only.
> I think it could be any crypto-dev that does support NULL auth/cipher.
As discussed offline it should be sufficient to test with the crypto_dev NULL PMD.
> > > As we always enqueue/dequeuer into valid_devs[0] - I think there is
> > > no point to have an arrays here, just single valid_dev should be sufficient.
> >
> > The test program may be started with several crypto_dev PMD's for example:
> >
> > test -c f -n 4 --vdev crypto_aesni_mb0 --vdev crypto_null0 --vdev
> > crypto_aesni_mb1 --vdev crypto_dev_null1
> >
> > In this case the valid_devs[] array will contain crypto_dev_null0 and
> crypto_dev_null1.
I will replace the valid_devs[] with valid_dev which contains the first crypto_null device found.
I will send a v2 patch
Regards,
Bernard.
next prev parent reply other threads:[~2019-01-17 10:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-15 11:19 Bernard Iremonger
2019-01-15 11:55 ` Ananyev, Konstantin
2019-01-15 12:34 ` Iremonger, Bernard
2019-01-15 12:49 ` Ananyev, Konstantin
2019-01-17 10:04 ` Iremonger, Bernard [this message]
2019-01-17 10:30 ` Ananyev, Konstantin
2019-01-17 11:12 ` Iremonger, Bernard
2019-01-17 10:15 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
2019-01-17 10:34 ` Ananyev, Konstantin
2019-01-17 11:20 ` Iremonger, Bernard
2019-01-17 15:35 ` Iremonger, Bernard
2019-01-17 16:03 ` [dpdk-dev] [PATCH v3] " Bernard Iremonger
2019-01-17 17:05 ` Ananyev, Konstantin
2019-01-17 23:30 ` Thomas Monjalon
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=8CEF83825BEC744B83065625E567D7C260D4F7FD@IRSMSX108.ger.corp.intel.com \
--to=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.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).