DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	Apeksha Gupta <apeksha.gupta@nxp.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Ruifeng.Wang@arm.com" <Ruifeng.Wang@arm.com>,
	"Doherty, Declan" <declan.doherty@intel.com>,
	"asomalap@amd.com" <asomalap@amd.com>,
	"anoobj@marvell.com" <anoobj@marvell.com>,
	"Zhang, Roy Fan" <roy.fan.zhang@intel.com>,
	"Trahe, Fiona" <fiona.trahe@intel.com>,
	"rnagadheeraj@marvell.com" <rnagadheeraj@marvell.com>,
	"adwivedi@marvell.com" <adwivedi@marvell.com>,
	"jianjay.zhou@huawei.com" <jianjay.zhou@huawei.com>,
	"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	"Dybkowski, AdamX" <adamx.dybkowski@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3] Test/crypto: check valid test_stats before	running test
Date: Fri, 15 May 2020 17:45:04 +0000
Message-ID: <VI1PR04MB3168E1B39930A1872BB0C380E6BD0@VI1PR04MB3168.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <BYAPR11MB33018B686A6F3EBB081D04139ABD0@BYAPR11MB3301.namprd11.prod.outlook.com>

Hi Konstantin,
> 
> > Test_stats is an optional cryptodev op and if it is not defined by the
> > PMD, it should not run the test cases for it.
> >
> > Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
> > ---
> >  app/test/test_cryptodev.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> > index c624018ee..1ad650675 100644
> > --- a/app/test/test_cryptodev.c
> > +++ b/app/test/test_cryptodev.c
> > @@ -8801,6 +8801,10 @@ test_stats(void)
> >  	if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
> >  		return -ENOTSUP;
> >
> > +	dev = &rte_cryptodevs[ts_params->valid_devs[0]];
> > +	if (dev->dev_ops->stats_get == 0)
> > +		return -ENOTSUP;
> > +
> >
> 
> rte_cryptodevs[] and dev_ops supposed to be internal for cryptodev
> (though in practice they are not).
> It is not a good practice for the app to access them directly.
> 

Yes, you are absolutely correct. The test case is not properly written.
App should not access the dev_ops directly.

Apeksha,
You can do the following change to fix this.

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 1ed2df898..aa14d42fa 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -8751,7 +8751,6 @@ test_stats(void)
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_cryptodev_stats stats;
        struct rte_cryptodev *dev;
-       cryptodev_stats_get_t temp_pfn;

        if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
                return -ENOTSUP;
@@ -8769,19 +8768,16 @@ test_stats(void)
                        &cap_idx) == NULL)
                return -ENOTSUP;

+       if (rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats)
+                       == -ENOTSUP)
+               return -ENOTSUP;
+
        rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
        TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600,
                        &stats) == -ENODEV),
                "rte_cryptodev_stats_get invalid dev failed");
        TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], 0) != 0),
                "rte_cryptodev_stats_get invalid Param failed");
-       dev = &rte_cryptodevs[ts_params->valid_devs[0]];
-       temp_pfn = dev->dev_ops->stats_get;
-       dev->dev_ops->stats_get = (cryptodev_stats_get_t)0;
-       TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats)
-                       == -ENOTSUP),
-               "rte_cryptodev_stats_get invalid Param failed");
-       dev->dev_ops->stats_get = temp_pfn;

        /* Test expected values */
        ut_setup();



  reply	other threads:[~2020-05-15 17:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  7:32 [dpdk-dev] [PATCH v2] " Apeksha Gupta
2020-05-15  7:42 ` Ruifeng Wang
2020-05-15  7:56 ` [dpdk-dev] [PATCH v3] " Apeksha Gupta
2020-05-15  8:03   ` Ruifeng Wang
2020-05-15 10:00   ` Ananyev, Konstantin
2020-05-15 17:45     ` Akhil Goyal [this message]
2020-05-16  1:55   ` [dpdk-dev] [PATCH v4] " Apeksha Gupta
2020-05-17 14:09     ` Akhil Goyal

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=VI1PR04MB3168E1B39930A1872BB0C380E6BD0@VI1PR04MB3168.eurprd04.prod.outlook.com \
    --to=akhil.goyal@nxp.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=adamx.dybkowski@intel.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=apeksha.gupta@nxp.com \
    --cc=asomalap@amd.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=rnagadheeraj@marvell.com \
    --cc=roy.fan.zhang@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git