ring: fix error vlaue of tail in the peek API for ST mode

Message ID 20200628062348.23063-1-feifei.wang2@arm.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series ring: fix error vlaue of tail in the peek API for ST mode |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Feifei Wang June 28, 2020, 6:23 a.m. UTC
The value of *tail should be the prod->tail not prod->head. After
modification, it can record 'tail' so head/tail can be updated
accordingly.

Fixes: 664ff4b1729b ("ring: introduce peek style API")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/librte_ring/rte_ring_peek_c11_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin June 28, 2020, 1:05 p.m. UTC | #1
> -----Original Message-----
> From: Feifei Wang <feifei.wang2@arm.com>
> Sent: Sunday, June 28, 2020 7:24 AM
> To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; stable@dpdk.org
> Subject: [PATCH] ring: fix error vlaue of tail in the peek API for ST mode
> 
> The value of *tail should be the prod->tail not prod->head. After
> modification, it can record 'tail' so head/tail can be updated
> accordingly.
> 
> Fixes: 664ff4b1729b ("ring: introduce peek style API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  lib/librte_ring/rte_ring_peek_c11_mem.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ring/rte_ring_peek_c11_mem.h b/lib/librte_ring/rte_ring_peek_c11_mem.h
> index 99321f124..283c7e70b 100644
> --- a/lib/librte_ring/rte_ring_peek_c11_mem.h
> +++ b/lib/librte_ring/rte_ring_peek_c11_mem.h
> @@ -40,7 +40,7 @@ __rte_ring_st_get_tail(struct rte_ring_headtail *ht, uint32_t *tail,
>  	RTE_ASSERT(n >= num);
>  	num = (n >= num) ? num : 0;
> 
> -	*tail = h;
> +	*tail = t;
>  	return num;
>  }
> 
> --

Thanks for the fix.
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.17.1
  
David Marchand July 1, 2020, 8:44 a.m. UTC | #2
On Sun, Jun 28, 2020 at 3:05 PM Ananyev, Konstantin
<konstantin.ananyev@intel.com> wrote:
> > -----Original Message-----
> > From: Feifei Wang <feifei.wang2@arm.com>
> > Sent: Sunday, June 28, 2020 7:24 AM
> > To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; stable@dpdk.org
> > Subject: [PATCH] ring: fix error vlaue of tail in the peek API for ST mode
> >
> > The value of *tail should be the prod->tail not prod->head. After
> > modification, it can record 'tail' so head/tail can be updated
> > accordingly.
> >
> > Fixes: 664ff4b1729b ("ring: introduce peek style API")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied, thanks.
  

Patch

diff --git a/lib/librte_ring/rte_ring_peek_c11_mem.h b/lib/librte_ring/rte_ring_peek_c11_mem.h
index 99321f124..283c7e70b 100644
--- a/lib/librte_ring/rte_ring_peek_c11_mem.h
+++ b/lib/librte_ring/rte_ring_peek_c11_mem.h
@@ -40,7 +40,7 @@  __rte_ring_st_get_tail(struct rte_ring_headtail *ht, uint32_t *tail,
 	RTE_ASSERT(n >= num);
 	num = (n >= num) ? num : 0;
 
-	*tail = h;
+	*tail = t;
 	return num;
 }