diff mbox series

[v4,4/8] crypto/scheduler: use proper API for device start/stop

Message ID 20211020112754.1270163-5-gakhil@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers show
Series cryptodev: hide internal structures | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Oct. 20, 2021, 11:27 a.m. UTC
The worker PMDs were using direct device start/stop
functions rather than rte_cryptodev_start(),
so rte_crypto_fp_ops never get set. This patch calls
the rte_cryptodev_start and stop APIs which start and
stop devices properly and fp_ops get set.

Reported-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 drivers/crypto/scheduler/scheduler_pmd_ops.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Zhang, Roy Fan Oct. 20, 2021, 11:31 a.m. UTC | #1
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Wednesday, October 20, 2021 12:28 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; david.marchand@redhat.com;
> hemant.agrawal@nxp.com; anoobj@marvell.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>;
> Doherty, Declan <declan.doherty@intel.com>; matan@nvidia.com;
> g.singh@nxp.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
> jianjay.zhou@huawei.com; asomalap@amd.com; ruifeng.wang@arm.com;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; ajit.khaparde@broadcom.com;
> rnagadheeraj@marvell.com; adwivedi@marvell.com; Power, Ciara
> <ciara.power@intel.com>; Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH v4 4/8] crypto/scheduler: use proper API for device
> start/stop
> 
> The worker PMDs were using direct device start/stop
> functions rather than rte_cryptodev_start(),
> so rte_crypto_fp_ops never get set. This patch calls
> the rte_cryptodev_start and stop APIs which start and
> stop devices properly and fp_ops get set.
> 
> Reported-by: Ciara Power <ciara.power@intel.com>
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> ---
>  drivers/crypto/scheduler/scheduler_pmd_ops.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> index 465b88ade8..f61640c9d6 100644
> --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> @@ -181,10 +181,7 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
>  	/* start all workers */
>  	for (i = 0; i < sched_ctx->nb_workers; i++) {
>  		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
> -		struct rte_cryptodev *worker_dev =
> -
> 	rte_cryptodev_pmd_get_dev(worker_dev_id);
> -
> -		ret = (*worker_dev->dev_ops->dev_start)(worker_dev);
> +		ret = rte_cryptodev_start(worker_dev_id);
>  		if (ret < 0) {
>  			CR_SCHED_LOG(ERR, "Failed to start worker dev %u",
>  					worker_dev_id);
> @@ -208,10 +205,8 @@ scheduler_pmd_stop(struct rte_cryptodev *dev)
>  	/* stop all workers first */
>  	for (i = 0; i < sched_ctx->nb_workers; i++) {
>  		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
> -		struct rte_cryptodev *worker_dev =
> -
> 	rte_cryptodev_pmd_get_dev(worker_dev_id);
> 
> -		(*worker_dev->dev_ops->dev_stop)(worker_dev);
> +		rte_cryptodev_stop(worker_dev_id);
>  	}
> 
>  	if (*sched_ctx->ops.scheduler_stop)
> --
> 2.25.1
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Ananyev, Konstantin Oct. 20, 2021, 12:20 p.m. UTC | #2
> > The worker PMDs were using direct device start/stop
> > functions rather than rte_cryptodev_start(),
> > so rte_crypto_fp_ops never get set. This patch calls
> > the rte_cryptodev_start and stop APIs which start and
> > stop devices properly and fp_ops get set.
> >
> > Reported-by: Ciara Power <ciara.power@intel.com>
> > Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> > ---
> >  drivers/crypto/scheduler/scheduler_pmd_ops.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> > b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> > index 465b88ade8..f61640c9d6 100644
> > --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
> > +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
> > @@ -181,10 +181,7 @@ scheduler_pmd_start(struct rte_cryptodev *dev)
> >  	/* start all workers */
> >  	for (i = 0; i < sched_ctx->nb_workers; i++) {
> >  		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
> > -		struct rte_cryptodev *worker_dev =
> > -
> > 	rte_cryptodev_pmd_get_dev(worker_dev_id);
> > -
> > -		ret = (*worker_dev->dev_ops->dev_start)(worker_dev);
> > +		ret = rte_cryptodev_start(worker_dev_id);
> >  		if (ret < 0) {
> >  			CR_SCHED_LOG(ERR, "Failed to start worker dev %u",
> >  					worker_dev_id);
> > @@ -208,10 +205,8 @@ scheduler_pmd_stop(struct rte_cryptodev *dev)
> >  	/* stop all workers first */
> >  	for (i = 0; i < sched_ctx->nb_workers; i++) {
> >  		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
> > -		struct rte_cryptodev *worker_dev =
> > -
> > 	rte_cryptodev_pmd_get_dev(worker_dev_id);
> >
> > -		(*worker_dev->dev_ops->dev_stop)(worker_dev);
> > +		rte_cryptodev_stop(worker_dev_id);
> >  	}
> >
> >  	if (*sched_ctx->ops.scheduler_stop)
> > --
> > 2.25.1
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
diff mbox series

Patch

diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 465b88ade8..f61640c9d6 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -181,10 +181,7 @@  scheduler_pmd_start(struct rte_cryptodev *dev)
 	/* start all workers */
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
-		struct rte_cryptodev *worker_dev =
-				rte_cryptodev_pmd_get_dev(worker_dev_id);
-
-		ret = (*worker_dev->dev_ops->dev_start)(worker_dev);
+		ret = rte_cryptodev_start(worker_dev_id);
 		if (ret < 0) {
 			CR_SCHED_LOG(ERR, "Failed to start worker dev %u",
 					worker_dev_id);
@@ -208,10 +205,8 @@  scheduler_pmd_stop(struct rte_cryptodev *dev)
 	/* stop all workers first */
 	for (i = 0; i < sched_ctx->nb_workers; i++) {
 		uint8_t worker_dev_id = sched_ctx->workers[i].dev_id;
-		struct rte_cryptodev *worker_dev =
-				rte_cryptodev_pmd_get_dev(worker_dev_id);
 
-		(*worker_dev->dev_ops->dev_stop)(worker_dev);
+		rte_cryptodev_stop(worker_dev_id);
 	}
 
 	if (*sched_ctx->ops.scheduler_stop)