[dpdk-dev] [PATCH v2] test/ipsec: fix test suite setup function
Iremonger, Bernard
bernard.iremonger at intel.com
Thu Jan 17 12:20:21 CET 2019
Hi Konstantin,
<snip>
> > Subject: [PATCH v2] test/ipsec: fix test suite setup function
> >
> > Check for valid crypto_null device before continuing.
> > Use valid_dev instead of valid_devs[].
> > Call create_crypto_session for one driver only.
> >
> > Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
> > Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
> > ---
> > test/test/test_ipsec.c | 91
> > +++++++++++++++++++++++++-------------------------
> > 1 file changed, 45 insertions(+), 46 deletions(-)
> >
> > diff --git a/test/test/test_ipsec.c b/test/test/test_ipsec.c index
> > ff1a1c4..a5c1c4b 100644
> > --- a/test/test/test_ipsec.c
> > +++ b/test/test/test_ipsec.c
> > @@ -62,7 +62,7 @@ struct ipsec_testsuite_params {
> > struct rte_cryptodev_config conf;
> > struct rte_cryptodev_qp_conf qp_conf;
> >
> > - uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
> > + uint8_t valid_dev;
> > uint8_t valid_dev_count;
> > };
> >
> > @@ -218,8 +218,9 @@ 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;
> > + int driver_id;
> >
> > memset(ts_params, 0, sizeof(*ts_params));
> >
> > @@ -251,10 +252,24 @@ testsuite_setup(void)
> > return TEST_FAILED;
> > }
> >
> > - ts_params->valid_devs[ts_params->valid_dev_count++] = 0;
> > + driver_id = rte_cryptodev_driver_id_get(
> > + RTE_STR(CRYPTODEV_NAME_NULL_PMD));
>
>
> I still think that guessing device capabilities by driver name is not a right
> approach.
> Please use check_device_capabilites() here.
Ok, this will require some refactoring of the tests.
> > +
> > + /* Find first valid crypto device */
> > + for (i = 0; i < nb_devs; i++) {
> > + rte_cryptodev_info_get(i, &info);
> > + if (info.driver_id == driver_id) {
> > + ts_params->valid_dev = i;
> > + ts_params->valid_dev_count++;
>
> As you use only one device now, I don't think you need valid_dev_count any
> more.
I will check if it is still needed.
> > + break;
> > + }
> > + }
> > +
> > + if (ts_params->valid_dev_count < 1)
> > + return TEST_FAILED;
> >
<snip>
Regards,
Bernard.
More information about the dev
mailing list