[v2,4/6] test/dmadev: check result for device stop

Message ID 20230116173738.562322-5-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series dma/ioat: fix issues with stopping and restarting device |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Jan. 16, 2023, 5:37 p.m. UTC
  The DMA device stop API can return an error value so check that return
value when running dmadev unit tests.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_dmadev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Conor Walsh Jan. 18, 2023, 10:47 a.m. UTC | #1
> The DMA device stop API can return an error value so check that return
> value when running dmadev unit tests.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Reviewed-by: Conor Walsh <conor.walsh@intel.com>
  
David Marchand Feb. 2, 2023, 11:12 a.m. UTC | #2
Hi Chengwen,

On Mon, Jan 16, 2023 at 6:38 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> The DMA device stop API can return an error value so check that return
> value when running dmadev unit tests.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  app/test/test_dmadev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Can you review the last three patches of this series?
Thanks!
  
Kevin Laatz Feb. 14, 2023, 4:04 p.m. UTC | #3
On 16/01/2023 17:37, Bruce Richardson wrote:
> The DMA device stop API can return an error value so check that return
> value when running dmadev unit tests.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   app/test/test_dmadev.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
  
fengchengwen Feb. 15, 2023, 1:26 a.m. UTC | #4
Sorry late to see.

On 2023/1/17 1:37, Bruce Richardson wrote:
> The DMA device stop API can return an error value so check that return
> value when running dmadev unit tests.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  app/test/test_dmadev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
> index fe62e98af8..4e1dbcaa19 100644
> --- a/app/test/test_dmadev.c
> +++ b/app/test/test_dmadev.c
> @@ -837,7 +837,11 @@ test_dmadev_instance(int16_t dev_id)
>  		goto err;
>  
>  	rte_mempool_free(pool);
> -	rte_dma_stop(dev_id);
> +
> +	if (rte_dma_stop(dev_id) < 0) {
> +		rte_mempool_free(pool);

The pool already freed in above.
I think just add ERR_RETURN here.

> +		ERR_RETURN("Error stopping device %u\n", dev_id);
> +	}
>  	rte_dma_stats_reset(dev_id, vchan);
>  	return 0;
>  
>
  
Bruce Richardson Feb. 15, 2023, 11:58 a.m. UTC | #5
On Wed, Feb 15, 2023 at 09:26:01AM +0800, fengchengwen wrote:
> Sorry late to see.
> 
> On 2023/1/17 1:37, Bruce Richardson wrote:
> > The DMA device stop API can return an error value so check that return
> > value when running dmadev unit tests.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  app/test/test_dmadev.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
> > index fe62e98af8..4e1dbcaa19 100644
> > --- a/app/test/test_dmadev.c
> > +++ b/app/test/test_dmadev.c
> > @@ -837,7 +837,11 @@ test_dmadev_instance(int16_t dev_id)
> >  		goto err;
> >  
> >  	rte_mempool_free(pool);
> > -	rte_dma_stop(dev_id);
> > +
> > +	if (rte_dma_stop(dev_id) < 0) {
> > +		rte_mempool_free(pool);
> 
> The pool already freed in above.
> I think just add ERR_RETURN here.
>
Yep, good catch. Will fix in v3.
  

Patch

diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index fe62e98af8..4e1dbcaa19 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -837,7 +837,11 @@  test_dmadev_instance(int16_t dev_id)
 		goto err;
 
 	rte_mempool_free(pool);
-	rte_dma_stop(dev_id);
+
+	if (rte_dma_stop(dev_id) < 0) {
+		rte_mempool_free(pool);
+		ERR_RETURN("Error stopping device %u\n", dev_id);
+	}
 	rte_dma_stats_reset(dev_id, vchan);
 	return 0;