patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH v1 1/2] ring: fix the misdescription of the param
       [not found] <20200729063105.11299-1-feifei.wang2@arm.com>
@ 2020-07-29  6:31 ` Feifei Wang
  2020-07-29 15:59   ` [dpdk-stable] [dpdk-dev] " David Marchand
  2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs Feifei Wang
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-29  6:31 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev; +Cc: dev, nd, Feifei Wang, stable

When enqueue one element to the ring, the param "obj" should be the
object to be added into the ring. The object is of type void*.

Fixes: af75078fece3 ("first public release")
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.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index da17ed6d7..418536b61 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table,
  * @param r
  *   A pointer to the ring structure.
  * @param obj
- *   A pointer to the object to be added.
+ *   A pointer (object) to be added.
  * @return
  *   - 0: Success; objects enqueued.
  *   - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
@@ -293,7 +293,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj)
  * @param r
  *   A pointer to the ring structure.
  * @param obj
- *   A pointer to the object to be added.
+ *   A pointer (object) to be added.
  * @return
  *   - 0: Success; objects enqueued.
  *   - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
@@ -314,7 +314,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj)
  * @param r
  *   A pointer to the ring structure.
  * @param obj
- *   A pointer to the object to be added.
+ *   A pointer (object) to be added.
  * @return
  *   - 0: Success; objects enqueued.
  *   - -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
       [not found] <20200729063105.11299-1-feifei.wang2@arm.com>
  2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 1/2] ring: fix the misdescription of the param Feifei Wang
@ 2020-07-29  6:31 ` Feifei Wang
  2020-07-29 13:48   ` [dpdk-stable] [dpdk-dev] " David Marchand
       [not found] ` <20200805061421.13037-1-feifei.wang2@arm.com>
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-29  6:31 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element (object of type void*) to ring in the
performance test, a pointer (the object to be enqueued) should be
passed to rte_ring_[sp|mp]enqueue APIs, not the pointer to a table
of void *pointers (objects).

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs Feifei Wang
@ 2020-07-29 13:48   ` " David Marchand
  2020-07-29 14:16     ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: David Marchand @ 2020-07-29 13:48 UTC (permalink / raw)
  To: Feifei Wang
  Cc: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz,
	dev, nd, dpdk stable

Hello Feifei,

On Wed, Jul 29, 2020 at 8:32 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> When enqueue one element (object of type void*) to ring in the
> performance test, a pointer (the object to be enqueued) should be
> passed to rte_ring_[sp|mp]enqueue APIs, not the pointer to a table
> of void *pointers (objects).

Good catch.
Are we missing a check in the UT so that dequeued object is what had
been enqueued?


>
> Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_ring.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h
> index aa6ae67ca..d4b15af7c 100644
> --- a/app/test/test_ring.h
> +++ b/app/test/test_ring.h
> @@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
>         if ((esize) == -1)
>                 switch (api_type) {
>                 case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
> -                       return rte_ring_enqueue(r, obj);
> +                       return rte_ring_enqueue(r, *obj);
>                 case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
> -                       return rte_ring_sp_enqueue(r, obj);
> +                       return rte_ring_sp_enqueue(r, *obj);
>                 case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
> -                       return rte_ring_mp_enqueue(r, obj);
> +                       return rte_ring_mp_enqueue(r, *obj);
>                 case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
>                         return rte_ring_enqueue_bulk(r, obj, n, NULL);
>                 case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
> --
> 2.17.1
>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29 13:48   ` [dpdk-stable] [dpdk-dev] " David Marchand
@ 2020-07-29 14:16     ` " Feifei Wang
  2020-07-29 14:21       ` [dpdk-stable] " David Marchand
  0 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-29 14:16 UTC (permalink / raw)
  To: David Marchand
  Cc: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz,
	dev, nd, dpdk stable, nd

Hi, David

> -----邮件原件-----
> 发件人: David Marchand <david.marchand@redhat.com>
> 发送时间: 2020年7月29日 21:48
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Konstantin
> Ananyev <konstantin.ananyev@intel.com>; Gavin Hu <Gavin.Hu@arm.com>;
> Olivier Matz <olivier.matz@6wind.com>; dev <dev@dpdk.org>; nd
> <nd@arm.com>; dpdk stable <stable@dpdk.org>
> 主题: Re: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the
> enqueue APIs
> 
> Hello Feifei,
> 
> On Wed, Jul 29, 2020 at 8:32 AM Feifei Wang <feifei.wang2@arm.com>
> wrote:
> >
> > When enqueue one element (object of type void*) to ring in the
> > performance test, a pointer (the object to be enqueued) should be
> > passed to rte_ring_[sp|mp]enqueue APIs, not the pointer to a table of
> > void *pointers (objects).
> 
> Good catch.
Thanks very much.
> Are we missing a check in the UT so that dequeued object is what had been
> enqueued?
> 
>  
Dequeue is not necessary to change because the param defined in rte_ring_dequeue
is different from that in rte_ring_enqueue:
rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a pointer (object) to be added in the ring
rte_ring_dequeue(struct rte_ring *r, void **obj_p): obj_p is a pointer to a void * pointer
(object) that will be filled.
> >
> > Fixes: a9fe152363e2 ("test/ring: add custom element size functional
> > tests")
> > Cc: honnappa.nagarahalli@arm.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >  app/test/test_ring.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test/test_ring.h b/app/test/test_ring.h index
> > aa6ae67ca..d4b15af7c 100644
> > --- a/app/test/test_ring.h
> > +++ b/app/test/test_ring.h
> > @@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj,
> int esize, unsigned int n,
> >         if ((esize) == -1)
> >                 switch (api_type) {
> >                 case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
> > -                       return rte_ring_enqueue(r, obj);
> > +                       return rte_ring_enqueue(r, *obj);
> >                 case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
> > -                       return rte_ring_sp_enqueue(r, obj);
> > +                       return rte_ring_sp_enqueue(r, *obj);
> >                 case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
> > -                       return rte_ring_mp_enqueue(r, obj);
> > +                       return rte_ring_mp_enqueue(r, *obj);
> >                 case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
> >                         return rte_ring_enqueue_bulk(r, obj, n, NULL);
> >                 case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
> > --
> > 2.17.1
> >
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29 14:16     ` [dpdk-stable] 回复: " Feifei Wang
@ 2020-07-29 14:21       ` " David Marchand
  2020-07-29 15:03         ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: David Marchand @ 2020-07-29 14:21 UTC (permalink / raw)
  To: Feifei Wang
  Cc: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz,
	dev, nd, dpdk stable

On Wed, Jul 29, 2020 at 4:16 PM Feifei Wang <Feifei.Wang2@arm.com> wrote:
> > Are we missing a check in the UT so that dequeued object is what had been
> > enqueued?
> >
> >
> Dequeue is not necessary to change because the param defined in rte_ring_dequeue
> is different from that in rte_ring_enqueue:
> rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a pointer (object) to be added in the ring
> rte_ring_dequeue(struct rte_ring *r, void **obj_p): obj_p is a pointer to a void * pointer
> (object) that will be filled.

That I get it.

What I meant is that the test enqueues an object in a ring until it is
full [1], then dequeues all the ring [2].
1: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n814
2: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n825

If the test had checked that dequeued objects are the right one, we
would have caught it.

But on the other hand, maybe another part of the functionnal ring
tests already check this and we only need to fix this issue here.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29 14:21       ` [dpdk-stable] " David Marchand
@ 2020-07-29 15:03         ` " Feifei Wang
  2020-07-29 21:24           ` [dpdk-stable] " Honnappa Nagarahalli
  0 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-29 15:03 UTC (permalink / raw)
  To: David Marchand
  Cc: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz,
	dev, nd, dpdk stable, nd



> -----邮件原件-----
> 发件人: David Marchand <david.marchand@redhat.com>
> 发送时间: 2020年7月29日 22:21
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Konstantin
> Ananyev <konstantin.ananyev@intel.com>; Gavin Hu <Gavin.Hu@arm.com>;
> Olivier Matz <olivier.matz@6wind.com>; dev <dev@dpdk.org>; nd
> <nd@arm.com>; dpdk stable <stable@dpdk.org>
> 主题: Re: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the
> enqueue APIs
> 
> On Wed, Jul 29, 2020 at 4:16 PM Feifei Wang <Feifei.Wang2@arm.com>
> wrote:
> > > Are we missing a check in the UT so that dequeued object is what had
> > > been enqueued?
> > >
> > >
> > Dequeue is not necessary to change because the param defined in
> > rte_ring_dequeue is different from that in rte_ring_enqueue:
> > rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a pointer
> > (object) to be added in the ring rte_ring_dequeue(struct rte_ring *r,
> > void **obj_p): obj_p is a pointer to a void * pointer
> > (object) that will be filled.
> 
> That I get it.
> 
> What I meant is that the test enqueues an object in a ring until it is full [1],
> then dequeues all the ring [2].
> 1: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n814
> 2: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n825
> 
> If the test had checked that dequeued objects are the right one, we would
> have caught it.
> 
> But on the other hand, maybe another part of the functionnal ring tests
> already check this and we only need to fix this issue here.

Sorry I just misunderstood you.
1. Actually, for the APIs of test_ring.h, we lack a test to check whether the
value of object enqueued into the ring matches that dequeued from the ring.
But it is mainly used to measure the length of time from enqueue to dequeue.
So I'm not sure it is necessary.
2. For the APIs of rte_ring.h, some tests can be used to test whether the
value of object enqueued into the ring matches that dequeued from the ring.
For example:
$table_autotest
$mbuf_autotest
> 
> 
> --
> David Marchand

--
Feifei


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
  2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 1/2] ring: fix the misdescription of the param Feifei Wang
@ 2020-07-29 15:59   ` " David Marchand
  2020-07-29 16:24     ` Ananyev, Konstantin
  2020-07-30 10:16     ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 2 replies; 37+ messages in thread
From: David Marchand @ 2020-07-29 15:59 UTC (permalink / raw)
  To: Feifei Wang, Ananyev, Konstantin, Honnappa Nagarahalli, Olivier Matz
  Cc: dev, nd, dpdk stable, Thomas Monjalon

On Wed, Jul 29, 2020 at 8:31 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> When enqueue one element to the ring, the param "obj" should be the
> object to be added into the ring. The object is of type void*.

I understand void * as a pointer to an object you don't know the type of.
I would keep the current description.

Honnappa, Konstantin, Olivier ?

>
> Fixes: af75078fece3 ("first public release")
> 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.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> index da17ed6d7..418536b61 100644
> --- a/lib/librte_ring/rte_ring.h
> +++ b/lib/librte_ring/rte_ring.h
> @@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table,
>   * @param r
>   *   A pointer to the ring structure.
>   * @param obj
> - *   A pointer to the object to be added.
> + *   A pointer (object) to be added.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
  2020-07-29 15:59   ` [dpdk-stable] [dpdk-dev] " David Marchand
@ 2020-07-29 16:24     ` Ananyev, Konstantin
  2020-07-29 19:34       ` Honnappa Nagarahalli
  2020-07-30 10:16     ` [dpdk-stable] 回复: " Feifei Wang
  1 sibling, 1 reply; 37+ messages in thread
From: Ananyev, Konstantin @ 2020-07-29 16:24 UTC (permalink / raw)
  To: David Marchand, Feifei Wang, Honnappa Nagarahalli, Olivier Matz
  Cc: dev, nd, dpdk stable, Thomas Monjalon

> >
> > When enqueue one element to the ring, the param "obj" should be the
> > object to be added into the ring. The object is of type void*.
> 
> I understand void * as a pointer to an object you don't know the type of.
> I would keep the current description.
> 
> Honnappa, Konstantin, Olivier ?

I think current one is a bit cleaner.
Konstantin


> 
> >
> > Fixes: af75078fece3 ("first public release")
> > 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.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> > index da17ed6d7..418536b61 100644
> > --- a/lib/librte_ring/rte_ring.h
> > +++ b/lib/librte_ring/rte_ring.h
> > @@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table,
> >   * @param r
> >   *   A pointer to the ring structure.
> >   * @param obj
> > - *   A pointer to the object to be added.
> > + *   A pointer (object) to be added.
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
  2020-07-29 16:24     ` Ananyev, Konstantin
@ 2020-07-29 19:34       ` Honnappa Nagarahalli
  0 siblings, 0 replies; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-07-29 19:34 UTC (permalink / raw)
  To: Ananyev, Konstantin, David Marchand, Feifei Wang, Olivier Matz
  Cc: dev, nd, dpdk stable, thomas, Honnappa Nagarahalli, nd

<snip>

> Subject: RE: [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the
> param
> 
> > >
> > > When enqueue one element to the ring, the param "obj" should be the
> > > object to be added into the ring. The object is of type void*.
> >
> > I understand void * as a pointer to an object you don't know the type of.
> > I would keep the current description.
> >
> > Honnappa, Konstantin, Olivier ?
> 
> I think current one is a bit cleaner.
+1, the existing documentation is fine.

> Konstantin
> 
> 
> >
> > >
> > > Fixes: af75078fece3 ("first public release")
> > > 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.h | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> > > index da17ed6d7..418536b61 100644
> > > --- a/lib/librte_ring/rte_ring.h
> > > +++ b/lib/librte_ring/rte_ring.h
> > > @@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *
> const *obj_table,
> > >   * @param r
> > >   *   A pointer to the ring structure.
> > >   * @param obj
> > > - *   A pointer to the object to be added.
> > > + *   A pointer (object) to be added.
> >
> >
> > --
> > David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29 15:03         ` [dpdk-stable] 回复: " Feifei Wang
@ 2020-07-29 21:24           ` " Honnappa Nagarahalli
  2020-07-30 10:28             ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-07-29 21:24 UTC (permalink / raw)
  To: Feifei Wang, David Marchand
  Cc: Konstantin Ananyev, Gavin Hu, Olivier Matz, dev, nd, dpdk stable,
	Honnappa Nagarahalli, nd

<snip>

> >
> > On Wed, Jul 29, 2020 at 4:16 PM Feifei Wang <Feifei.Wang2@arm.com>
> > wrote:
> > > > Are we missing a check in the UT so that dequeued object is what
> > > > had been enqueued?
Yes, missing for single element enqueue/dequeue

> > > >
> > > >
> > > Dequeue is not necessary to change because the param defined in
> > > rte_ring_dequeue is different from that in rte_ring_enqueue:
> > > rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a pointer
> > > (object) to be added in the ring rte_ring_dequeue(struct rte_ring
> > > *r, void **obj_p): obj_p is a pointer to a void * pointer
> > > (object) that will be filled.
> >
> > That I get it.
> >
> > What I meant is that the test enqueues an object in a ring until it is
> > full [1], then dequeues all the ring [2].
> > 1: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n814
> > 2: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n825
> >
> > If the test had checked that dequeued objects are the right one, we
> > would have caught it.
> >
> > But on the other hand, maybe another part of the functionnal ring
> > tests already check this and we only need to fix this issue here.
> 
> Sorry I just misunderstood you.
> 1. Actually, for the APIs of test_ring.h, we lack a test to check whether the
> value of object enqueued into the ring matches that dequeued from the ring.
> But it is mainly used to measure the length of time from enqueue to dequeue.
> So I'm not sure it is necessary.
> 2. For the APIs of rte_ring.h, some tests can be used to test whether the value
> of object enqueued into the ring matches that dequeued from the ring.
> For example:
> $table_autotest
> $mbuf_autotest
The dequeued objects are checked against the enqueued objects for the bulk and burst APIs. Look at tests test_ring_burst_bulk_tests1..4. 'memcmp' is used to compare the enqueued objects against the dequeued ones.
Similar comparison can be added in test_ring_basic_ex, test_ring_with_exact_size functions.

> >
> >
> > --
> > David Marchand
> 
> --
> Feifei
> 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
  2020-07-29 15:59   ` [dpdk-stable] [dpdk-dev] " David Marchand
  2020-07-29 16:24     ` Ananyev, Konstantin
@ 2020-07-30 10:16     ` " Feifei Wang
  2020-07-31  5:26       ` [dpdk-stable] " Honnappa Nagarahalli
  1 sibling, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-30 10:16 UTC (permalink / raw)
  To: David Marchand, Ananyev, Konstantin, Honnappa Nagarahalli, Olivier Matz
  Cc: dev, nd, dpdk stable, thomas, nd

Hi, David, Konstantin and Honnappa

> -----邮件原件-----
> 发件人: David Marchand <david.marchand@redhat.com>
> 发送时间: 2020年7月30日 0:00
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Olivier Matz <olivier.matz@6wind.com>
> 抄送: dev <dev@dpdk.org>; nd <nd@arm.com>; dpdk stable
> <stable@dpdk.org>; thomas@monjalon.net
> 主题: Re: [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
> 
> On Wed, Jul 29, 2020 at 8:31 AM Feifei Wang <feifei.wang2@arm.com>
> wrote:
> >
> > When enqueue one element to the ring, the param "obj" should be the
> > object to be added into the ring. The object is of type void*.
> 
> I understand void * as a pointer to an object you don't know the type of.
> I would keep the current description.
> 
Sorry for my commit message cannot express my view clearly. 
Following is my supplementary explanation of this:

First,  the APIs to be changed are:
1. rte_ring_mp_enqueue
2. rte_ring_sp_enqueue
3. rte_ring_enqueue

Second, Let's use an example to explain this:
1. We call API in form: rte_ring_enqueue(r, obj).
2. Current function header indicates that we will have ring[idx] = *obj.
3. However, this is not the case, what we eventually have is: ring[idx] = obj.

So I think the current function header is misleading or
maybe the implementation of above three functions need to be changed.

> Honnappa, Konstantin, Olivier ?
> 
> >
> > Fixes: af75078fece3 ("first public release")
> > 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.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> > index da17ed6d7..418536b61 100644
> > --- a/lib/librte_ring/rte_ring.h
> > +++ b/lib/librte_ring/rte_ring.h
> > @@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *
> const *obj_table,
> >   * @param r
> >   *   A pointer to the ring structure.
> >   * @param obj
> > - *   A pointer to the object to be added.
> > + *   A pointer (object) to be added.
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-29 21:24           ` [dpdk-stable] " Honnappa Nagarahalli
@ 2020-07-30 10:28             ` " Feifei Wang
  2020-07-31  6:25               ` Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-07-30 10:28 UTC (permalink / raw)
  To: Honnappa Nagarahalli, David Marchand
  Cc: Konstantin Ananyev, Gavin Hu, Olivier Matz, dev, nd, dpdk stable, nd, nd



> -----邮件原件-----
> 发件人: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> 发送时间: 2020年7月30日 5:24
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; David Marchand
> <david.marchand@redhat.com>
> 抄送: Konstantin Ananyev <konstantin.ananyev@intel.com>; Gavin Hu
> <Gavin.Hu@arm.com>; Olivier Matz <olivier.matz@6wind.com>; dev
> <dev@dpdk.org>; nd <nd@arm.com>; dpdk stable <stable@dpdk.org>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> 主题: RE: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the
> enqueue APIs
> 
> <snip>
> 
> > >
> > > On Wed, Jul 29, 2020 at 4:16 PM Feifei Wang <Feifei.Wang2@arm.com>
> > > wrote:
> > > > > Are we missing a check in the UT so that dequeued object is what
> > > > > had been enqueued?
> Yes, missing for single element enqueue/dequeue
> 
> > > > >
> > > > >
> > > > Dequeue is not necessary to change because the param defined in
> > > > rte_ring_dequeue is different from that in rte_ring_enqueue:
> > > > rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a pointer
> > > > (object) to be added in the ring rte_ring_dequeue(struct rte_ring
> > > > *r, void **obj_p): obj_p is a pointer to a void * pointer
> > > > (object) that will be filled.
> > >
> > > That I get it.
> > >
> > > What I meant is that the test enqueues an object in a ring until it
> > > is full [1], then dequeues all the ring [2].
> > > 1: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n814
> > > 2: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n825
> > >
> > > If the test had checked that dequeued objects are the right one, we
> > > would have caught it.
> > >
> > > But on the other hand, maybe another part of the functionnal ring
> > > tests already check this and we only need to fix this issue here.
> >
> > Sorry I just misunderstood you.
> > 1. Actually, for the APIs of test_ring.h, we lack a test to check
> > whether the value of object enqueued into the ring matches that dequeued
> from the ring.
> > But it is mainly used to measure the length of time from enqueue to
> dequeue.
> > So I'm not sure it is necessary.
> > 2. For the APIs of rte_ring.h, some tests can be used to test whether
> > the value of object enqueued into the ring matches that dequeued from the
> ring.
> > For example:
> > $table_autotest
> > $mbuf_autotest
> The dequeued objects are checked against the enqueued objects for the bulk
> and burst APIs. Look at tests test_ring_burst_bulk_tests1..4. 'memcmp' is used
> to compare the enqueued objects against the dequeued ones.
> Similar comparison can be added in test_ring_basic_ex,
> test_ring_with_exact_size functions.
Thank you for bringing that up.
> 
> > >
> > >
> > > --
> > > David Marchand
> >
> > --
> > Feifei
> >


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the param
  2020-07-30 10:16     ` [dpdk-stable] 回复: " Feifei Wang
@ 2020-07-31  5:26       ` " Honnappa Nagarahalli
  0 siblings, 0 replies; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-07-31  5:26 UTC (permalink / raw)
  To: Feifei Wang, David Marchand, Ananyev, Konstantin, Olivier Matz
  Cc: dev, nd, dpdk stable, thomas, Honnappa Nagarahalli, nd

<snip>

> > 主题: Re: [dpdk-dev] [PATCH v1 1/2] ring: fix the misdescription of the
> > param
> >
> > On Wed, Jul 29, 2020 at 8:31 AM Feifei Wang <feifei.wang2@arm.com>
> > wrote:
> > >
> > > When enqueue one element to the ring, the param "obj" should be the
> > > object to be added into the ring. The object is of type void*.
> >
> > I understand void * as a pointer to an object you don't know the type of.
> > I would keep the current description.
> >
> Sorry for my commit message cannot express my view clearly.
> Following is my supplementary explanation of this:
> 
> First,  the APIs to be changed are:
> 1. rte_ring_mp_enqueue
> 2. rte_ring_sp_enqueue
> 3. rte_ring_enqueue
> 
> Second, Let's use an example to explain this:
> 1. We call API in form: rte_ring_enqueue(r, obj).
> 2. Current function header indicates that we will have ring[idx] = *obj.
When you say function header, I am assuming you are talking about the documentation. IMO, the current documentation does not convey any details of the implementation. It is talking about what is expected from the user.

> 3. However, this is not the case, what we eventually have is: ring[idx] = obj.
> 
> So I think the current function header is misleading or maybe the
> implementation of above three functions need to be changed.
> 
> > Honnappa, Konstantin, Olivier ?
> >
> > >
> > > Fixes: af75078fece3 ("first public release")
> > > 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.h | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> > > index da17ed6d7..418536b61 100644
> > > --- a/lib/librte_ring/rte_ring.h
> > > +++ b/lib/librte_ring/rte_ring.h
> > > @@ -276,7 +276,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *
> > const *obj_table,
> > >   * @param r
> > >   *   A pointer to the ring structure.
> > >   * @param obj
> > > - *   A pointer to the object to be added.
> > > + *   A pointer (object) to be added.
> >
> >
> > --
> > David Marchand
> 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs
  2020-07-30 10:28             ` [dpdk-stable] 回复: " Feifei Wang
@ 2020-07-31  6:25               ` Feifei Wang
  0 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-07-31  6:25 UTC (permalink / raw)
  To: Honnappa Nagarahalli, David Marchand
  Cc: Konstantin Ananyev, Gavin Hu, Olivier Matz, dev, nd, dpdk stable,
	nd, nd, nd



> -----邮件原件-----
> 发件人: Feifei Wang
> 发送时间: 2020年7月30日 18:29
> 收件人: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; David
> Marchand <david.marchand@redhat.com>
> 抄送: Konstantin Ananyev <konstantin.ananyev@intel.com>; Gavin Hu
> <Gavin.Hu@arm.com>; Olivier Matz <olivier.matz@6wind.com>; dev
> <dev@dpdk.org>; nd <nd@arm.com>; dpdk stable <stable@dpdk.org>; nd
> <nd@arm.com>; nd <nd@arm.com>
> 主题: 回复: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to
> the enqueue APIs
> 
> 
> 
> > -----邮件原件-----
> > 发件人: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> > 发送时间: 2020年7月30日 5:24
> > 收件人: Feifei Wang <Feifei.Wang2@arm.com>; David Marchand
> > <david.marchand@redhat.com>
> > 抄送: Konstantin Ananyev <konstantin.ananyev@intel.com>; Gavin Hu
> > <Gavin.Hu@arm.com>; Olivier Matz <olivier.matz@6wind.com>; dev
> > <dev@dpdk.org>; nd <nd@arm.com>; dpdk stable <stable@dpdk.org>;
> > Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; nd
> <nd@arm.com>
> > 主题: RE: [dpdk-dev] [PATCH v1 2/2] test/ring: fix wrong param passed to
> > the enqueue APIs
> >
> > <snip>
> >
> > > >
> > > > On Wed, Jul 29, 2020 at 4:16 PM Feifei Wang <Feifei.Wang2@arm.com>
> > > > wrote:
> > > > > > Are we missing a check in the UT so that dequeued object is
> > > > > > what had been enqueued?
> > Yes, missing for single element enqueue/dequeue
> >
> > > > > >
> > > > > >
> > > > > Dequeue is not necessary to change because the param defined in
> > > > > rte_ring_dequeue is different from that in rte_ring_enqueue:
> > > > > rte_ring_enqueue(struct rte_ring *r, void *obj): obj is a
> > > > > pointer
> > > > > (object) to be added in the ring rte_ring_dequeue(struct
> > > > > rte_ring *r, void **obj_p): obj_p is a pointer to a void *
> > > > > pointer
> > > > > (object) that will be filled.
> > > >
> > > > That I get it.
> > > >
> > > > What I meant is that the test enqueues an object in a ring until
> > > > it is full [1], then dequeues all the ring [2].
> > > > 1: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n814
> > > > 2: https://git.dpdk.org/dpdk/tree/app/test/test_ring.c#n825
> > > >
> > > > If the test had checked that dequeued objects are the right one,
> > > > we would have caught it.
> > > >
> > > > But on the other hand, maybe another part of the functionnal ring
> > > > tests already check this and we only need to fix this issue here.
> > >
> > > Sorry I just misunderstood you.
> > > 1. Actually, for the APIs of test_ring.h, we lack a test to check
> > > whether the value of object enqueued into the ring matches that
> > > dequeued
> > from the ring.
> > > But it is mainly used to measure the length of time from enqueue to
> > dequeue.
> > > So I'm not sure it is necessary.
> > > 2. For the APIs of rte_ring.h, some tests can be used to test
> > > whether the value of object enqueued into the ring matches that
> > > dequeued from the
> > ring.
> > > For example:
> > > $table_autotest
> > > $mbuf_autotest
> > The dequeued objects are checked against the enqueued objects for the
> > bulk and burst APIs. Look at tests test_ring_burst_bulk_tests1..4.
> > 'memcmp' is used to compare the enqueued objects against the dequeued
> ones.
> > Similar comparison can be added in test_ring_basic_ex,
> > test_ring_with_exact_size functions.
> Thank you for bringing that up.
Next, I will adding the test to check the value of dequeue against enqueue in
test_ring_basic_ex,  test_ring_with_exact_size functions. Furthermore, I will pack
it and the current patch together and upload the new version to the community. 
> >
> > > >
> > > >
> > > > --
> > > > David Marchand
> > >
> > > --
> > > Feifei
> > >


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v2 1/4] test/ring: fix wrong parameter passed to the enqueue APIs
       [not found] ` <20200805061421.13037-1-feifei.wang2@arm.com>
@ 2020-08-05  6:14   ` " Feifei Wang
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp Feifei Wang
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-08-05  6:14 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element to ring in the performance test, a pointer
should be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer
to a table of void *pointers.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp
       [not found] ` <20200805061421.13037-1-feifei.wang2@arm.com>
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 1/4] test/ring: fix wrong parameter " Feifei Wang
@ 2020-08-05  6:14   ` Feifei Wang
  2020-08-26 20:51     ` Honnappa Nagarahalli
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements Feifei Wang
  2 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-08-05  6:14 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz
  Cc: dev, nd, Feifei Wang, stable

When using memcmp function to check data, the third param should be the
size of all elements, rather than the number of the elements.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_ring.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 0ae97d341..c508a13a9 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 			TEST_RING_VERIFY(rte_ring_empty(r));
 
 			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
+			if (esize[i] == -1) {
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * sizeof(void *)) == 0);
+			} else
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * esize[i]) == 0);
 		}
 
 		/* Free memory before test completed */
@@ -538,9 +543,11 @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
 			goto fail;
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
       [not found] ` <20200805061421.13037-1-feifei.wang2@arm.com>
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 1/4] test/ring: fix wrong parameter " Feifei Wang
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp Feifei Wang
@ 2020-08-05  6:14   ` Feifei Wang
  2020-08-26 20:51     ` Honnappa Nagarahalli
  2 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-08-05  6:14 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

The actual capacity of ring should be the (RING_SIZE - 1), thus only
(RING_SIZE - 1) elements can be enqueued into the ring.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index c508a13a9..51bae0d48 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
 		printf("%u ring entries are now free\n",
 			rte_ring_free_count(rp));
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_enqueue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
@@ -833,7 +833,7 @@ test_ring_basic_ex(void)
 			goto fail_test;
 		}
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_dequeue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements Feifei Wang
@ 2020-08-26 20:51     ` Honnappa Nagarahalli
  2020-08-27  8:54       ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-08-26 20:51 UTC (permalink / raw)
  To: Feifei Wang, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable, Honnappa Nagarahalli, nd

<snip>

> Subject: [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
> 
> The actual capacity of ring should be the (RING_SIZE - 1), thus only (RING_SIZE
> - 1) elements can be enqueued into the ring.
> 
> Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
This issue is not because of this commit. It is coming from af75078fece3.

> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_ring.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> c508a13a9..51bae0d48 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -822,7 +822,7 @@ test_ring_basic_ex(void)
>  		printf("%u ring entries are now free\n",
>  			rte_ring_free_count(rp));
> 
> -		for (j = 0; j < RING_SIZE; j++) {
> +		for (j = 0; j < RING_SIZE - 1; j++) {
>  			test_ring_enqueue(rp, obj, esize[i], 1,
>  				TEST_RING_THREAD_DEF |
> TEST_RING_ELEM_SINGLE);
Can you validate the return value of this function (which should have caught the error)?

>  		}
> @@ -833,7 +833,7 @@ test_ring_basic_ex(void)
>  			goto fail_test;
>  		}
> 
> -		for (j = 0; j < RING_SIZE; j++) {
> +		for (j = 0; j < RING_SIZE - 1; j++) {
>  			test_ring_dequeue(rp, obj, esize[i], 1,
>  				TEST_RING_THREAD_DEF |
> TEST_RING_ELEM_SINGLE);
Same here.

>  		}
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp
  2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp Feifei Wang
@ 2020-08-26 20:51     ` Honnappa Nagarahalli
  2020-08-27  9:05       ` [dpdk-stable] 回复: " Feifei Wang
  0 siblings, 1 reply; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-08-26 20:51 UTC (permalink / raw)
  To: Feifei Wang, Konstantin Ananyev, Gavin Hu, Olivier Matz
  Cc: dev, nd, Feifei Wang, stable, Honnappa Nagarahalli, nd

<snip>

> 
> When using memcmp function to check data, the third param should be the
> size of all elements, rather than the number of the elements.
> 
> Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_ring.c | 31 +++++++++++++++++++++----------
>  1 file changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> 0ae97d341..c508a13a9 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
>  			TEST_RING_VERIFY(rte_ring_empty(r));
> 
>  			/* check data */
> -			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
> +			if (esize[i] == -1) {
> +				TEST_RING_VERIFY(memcmp(src, dst,
> +					rsz * sizeof(void *)) == 0);
> +			} else
> +				TEST_RING_VERIFY(memcmp(src, dst,
> +					rsz * esize[i]) == 0);
Can you implement a function similar to 'test_ring_mem_init' to do this comparison?

>  		}
> 
>  		/* Free memory before test completed */ @@ -538,9 +543,11
> @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
>  		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> +			rte_hexdump(stdout, "src", src,
> +					RTE_PTR_DIFF(cur_src, src));
> +			rte_hexdump(stdout, "dst", dst,
> +					RTE_PTR_DIFF(cur_dst, dst));
I do not think, this change and the rest below are bug fixes. Can you please separate them into another commit?

>  			printf("data after dequeue is not the same\n");
>  			goto fail;
>  		}
> @@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
>  		}
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> +			rte_hexdump(stdout, "src", src,
> +					RTE_PTR_DIFF(cur_src, src));
> +			rte_hexdump(stdout, "dst", dst,
> +					RTE_PTR_DIFF(cur_dst, dst));
>  			printf("data after dequeue is not the same\n");
>  			goto fail;
>  		}
> @@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
>  			goto fail;
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> +			rte_hexdump(stdout, "src", src,
> +					RTE_PTR_DIFF(cur_src, src));
> +			rte_hexdump(stdout, "dst", dst,
> +					RTE_PTR_DIFF(cur_dst, dst));
>  			printf("data after dequeue is not the same\n");
>  			goto fail;
>  		}
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
  2020-08-26 20:51     ` Honnappa Nagarahalli
@ 2020-08-27  8:54       ` " Feifei Wang
  0 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-08-27  8:54 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, stable, nd, nd



> -----邮件原件-----
> 发件人: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> 发送时间: 2020年8月27日 4:51
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; Konstantin Ananyev
> <konstantin.ananyev@intel.com>; Olivier Matz <olivier.matz@6wind.com>;
> Gavin Hu <Gavin.Hu@arm.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> <Feifei.Wang2@arm.com>; stable@dpdk.org; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> 主题: RE: [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
> 
> <snip>
> 
> > Subject: [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements
> >
> > The actual capacity of ring should be the (RING_SIZE - 1), thus only
> (RING_SIZE
> > - 1) elements can be enqueued into the ring.
> >
> > Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> This issue is not because of this commit. It is coming from af75078fece3.
Sorry for my mistake, I will correct it.
> 
> > Cc: honnappa.nagarahalli@arm.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >  app/test/test_ring.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> > c508a13a9..51bae0d48 100644
> > --- a/app/test/test_ring.c
> > +++ b/app/test/test_ring.c
> > @@ -822,7 +822,7 @@ test_ring_basic_ex(void)
> >  		printf("%u ring entries are now free\n",
> >  			rte_ring_free_count(rp));
> >
> > -		for (j = 0; j < RING_SIZE; j++) {
> > +		for (j = 0; j < RING_SIZE - 1; j++) {
> >  			test_ring_enqueue(rp, obj, esize[i], 1,
> >  				TEST_RING_THREAD_DEF |
> > TEST_RING_ELEM_SINGLE);
> Can you validate the return value of this function (which should have caught the
> error)?
Ok, only for these two loops, I will add test to validate the number of enqueue/dequeue elements.
> 
> >  		}
> > @@ -833,7 +833,7 @@ test_ring_basic_ex(void)
> >  			goto fail_test;
> >  		}
> >
> > -		for (j = 0; j < RING_SIZE; j++) {
> > +		for (j = 0; j < RING_SIZE - 1; j++) {
> >  			test_ring_dequeue(rp, obj, esize[i], 1,
> >  				TEST_RING_THREAD_DEF |
> > TEST_RING_ELEM_SINGLE);
> Same here.
> 
> >  		}
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] 回复: [PATCH v2 2/4] test/ring: fix wrong size used in memcmp
  2020-08-26 20:51     ` Honnappa Nagarahalli
@ 2020-08-27  9:05       ` " Feifei Wang
  0 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-08-27  9:05 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz
  Cc: dev, nd, stable, nd, nd



> -----邮件原件-----
> 发件人: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> 发送时间: 2020年8月27日 4:52
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; Konstantin Ananyev
> <konstantin.ananyev@intel.com>; Gavin Hu <Gavin.Hu@arm.com>; Olivier
> Matz <olivier.matz@6wind.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> <Feifei.Wang2@arm.com>; stable@dpdk.org; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> 主题: RE: [PATCH v2 2/4] test/ring: fix wrong size used in memcmp
> 
> <snip>
> 
> >
> > When using memcmp function to check data, the third param should be
> > the size of all elements, rather than the number of the elements.
> >
> > Fixes: a9fe152363e2 ("test/ring: add custom element size functional
> > tests")
> > Cc: honnappa.nagarahalli@arm.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >  app/test/test_ring.c | 31 +++++++++++++++++++++----------
> >  1 file changed, 21 insertions(+), 10 deletions(-)
> >
> > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> > 0ae97d341..c508a13a9 100644
> > --- a/app/test/test_ring.c
> > +++ b/app/test/test_ring.c
> > @@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
> >  			TEST_RING_VERIFY(rte_ring_empty(r));
> >
> >  			/* check data */
> > -			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
> > +			if (esize[i] == -1) {
> > +				TEST_RING_VERIFY(memcmp(src, dst,
> > +					rsz * sizeof(void *)) == 0);
> > +			} else
> > +				TEST_RING_VERIFY(memcmp(src, dst,
> > +					rsz * esize[i]) == 0);
> Can you implement a function similar to 'test_ring_mem_init' to do this
> comparison?
Ok, the new function named 'test_ring_mem_cmp' will be added.
> 
> >  		}
> >
> >  		/* Free memory before test completed */ @@ -538,9 +543,11
> @@
> > test_ring_burst_bulk_tests2(unsigned int test_idx)
> >  		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
> >
> >  		/* check data */
> > -		if (memcmp(src, dst, cur_dst - dst)) {
> > -			rte_hexdump(stdout, "src", src, cur_src - src);
> > -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> > +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> > +			rte_hexdump(stdout, "src", src,
> > +					RTE_PTR_DIFF(cur_src, src));
> > +			rte_hexdump(stdout, "dst", dst,
> > +					RTE_PTR_DIFF(cur_dst, dst));
> I do not think, this change and the rest below are bug fixes. Can you please
> separate them into another commit?
Actually, in the original code, 'memcmp' wants to check  all bytes and ' rte_hexdump ' wants to print all bytes. 
However, 'cur_dst - dst' and 'cur_src - src' is the number of all elements rather the bytes of all elements.
As a result, we need to correct it and make them check all bytes of the ring.
> 
> >  			printf("data after dequeue is not the same\n");
> >  			goto fail;
> >  		}
> > @@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
> >  		}
> >
> >  		/* check data */
> > -		if (memcmp(src, dst, cur_dst - dst)) {
> > -			rte_hexdump(stdout, "src", src, cur_src - src);
> > -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> > +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> > +			rte_hexdump(stdout, "src", src,
> > +					RTE_PTR_DIFF(cur_src, src));
> > +			rte_hexdump(stdout, "dst", dst,
> > +					RTE_PTR_DIFF(cur_dst, dst));
> >  			printf("data after dequeue is not the same\n");
> >  			goto fail;
> >  		}
> > @@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
> >  			goto fail;
> >
> >  		/* check data */
> > -		if (memcmp(src, dst, cur_dst - dst)) {
> > -			rte_hexdump(stdout, "src", src, cur_src - src);
> > -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> > +		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
> > +			rte_hexdump(stdout, "src", src,
> > +					RTE_PTR_DIFF(cur_src, src));
> > +			rte_hexdump(stdout, "dst", dst,
> > +					RTE_PTR_DIFF(cur_dst, dst));
> >  			printf("data after dequeue is not the same\n");
> >  			goto fail;
> >  		}
> > --
> > 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs
       [not found] ` <20200911161002.19816-1-feifei.wang2@arm.com>
@ 2020-09-11 16:09   ` Feifei Wang
  2020-09-14  4:28     ` Honnappa Nagarahalli
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements Feifei Wang
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-09-11 16:09 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element to ring in the performance test, a pointer
should be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer
to a table of void *pointers.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements
       [not found] ` <20200911161002.19816-1-feifei.wang2@arm.com>
  2020-09-11 16:09   ` [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
@ 2020-09-11 16:10   ` Feifei Wang
  2020-09-14  4:31     ` Honnappa Nagarahalli
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-09-11 16:10 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev; +Cc: dev, nd, Feifei Wang, stable

The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of
elements can be enqueued into the ring.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 63d44d85e..811adc523 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
 		printf("%u ring entries are now free\n",
 			rte_ring_free_count(rp));
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			ret = test_ring_enqueue(rp, cur_src, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 			if (ret != 0) {
@@ -839,7 +839,7 @@ test_ring_basic_ex(void)
 			goto fail_test;
 		}
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			ret = test_ring_dequeue(rp, cur_dst, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 			if (ret != 0) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp
       [not found] ` <20200911161002.19816-1-feifei.wang2@arm.com>
  2020-09-11 16:09   ` [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements Feifei Wang
@ 2020-09-11 16:10   ` Feifei Wang
  2020-09-14  4:37     ` Honnappa Nagarahalli
  2 siblings, 1 reply; 37+ messages in thread
From: Feifei Wang @ 2020-09-11 16:10 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When using memcmp function to check data, the third param should be the
size of all elements, rather than the number of the elements.

Furthermore, do code clean up by moving repeated code inside
'test_ring_mem_cmp' function to validate data and print information of
enqueue/dequeue elements if validation fails.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
---
 app/test/test_ring.c | 59 ++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 32 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 811adc523..4a2bd39fc 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -258,6 +258,21 @@ test_ring_mem_init(void *obj, unsigned int count, int esize)
 			((uint32_t *)obj)[i] = i;
 }
 
+static int
+test_ring_mem_cmp(void *src, void *dst, unsigned int size)
+{
+	int ret;
+
+	ret = memcmp(src, dst, size);
+	if (ret) {
+		rte_hexdump(stdout, "src", src, size);
+		rte_hexdump(stdout, "dst", dst, size);
+		printf("data after dequeue is not the same\n");
+	}
+
+	return ret;
+}
+
 static void
 test_ring_print_test_string(const char *istr, unsigned int api_type, int esize)
 {
@@ -383,7 +398,7 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 	struct rte_ring *r;
 	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
 	int ret;
-	unsigned int i, j;
+	unsigned int i, j, temp_sz;
 	int rand;
 	const unsigned int rsz = RING_SIZE - 1;
 
@@ -444,7 +459,11 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 			TEST_RING_VERIFY(rte_ring_empty(r));
 
 			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
+			temp_sz = rsz * sizeof(void *);
+			if (esize[i] != -1)
+				temp_sz = rsz * esize[i];
+			TEST_RING_VERIFY(test_ring_mem_cmp(src, dst,
+						temp_sz) == 0);
 		}
 
 		/* Free memory before test completed */
@@ -538,12 +557,8 @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
 			goto fail;
-		}
 
 		/* Free memory before test completed */
 		rte_ring_free(r);
@@ -614,12 +629,8 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
 			goto fail;
-		}
 
 		/* Free memory before test completed */
 		rte_ring_free(r);
@@ -747,12 +758,8 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
 			goto fail;
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
 			goto fail;
-		}
 
 		/* Free memory before test completed */
 		rte_ring_free(r);
@@ -857,12 +864,8 @@ test_ring_basic_ex(void)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_src - src)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_src, src)))
 			goto fail_test;
-		}
 
 		/* Following tests use the configured flags to decide
 		 * SP/SC or MP/MC.
@@ -909,12 +912,8 @@ test_ring_basic_ex(void)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
 			goto fail_test;
-		}
 
 		rte_ring_free(rp);
 		rte_free(src);
@@ -1047,12 +1046,8 @@ test_ring_with_exact_size(void)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
 			goto test_fail;
-		}
 
 		rte_free(src_orig);
 		rte_free(dst_orig);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs
  2020-09-11 16:09   ` [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
@ 2020-09-14  4:28     ` Honnappa Nagarahalli
  0 siblings, 0 replies; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-09-14  4:28 UTC (permalink / raw)
  To: Feifei Wang, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable, Honnappa Nagarahalli, nd

<snip>

> 
> When enqueue one element to ring in the performance test, a pointer should
> be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer to a table of
> void *pointers.
> 
> Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  app/test/test_ring.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h index
> aa6ae67ca..d4b15af7c 100644
> --- a/app/test/test_ring.h
> +++ b/app/test/test_ring.h
> @@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int
> esize, unsigned int n,
>  	if ((esize) == -1)
>  		switch (api_type) {
>  		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
> -			return rte_ring_enqueue(r, obj);
> +			return rte_ring_enqueue(r, *obj);
>  		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
> -			return rte_ring_sp_enqueue(r, obj);
> +			return rte_ring_sp_enqueue(r, *obj);
>  		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
> -			return rte_ring_mp_enqueue(r, obj);
> +			return rte_ring_mp_enqueue(r, *obj);
>  		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
>  			return rte_ring_enqueue_bulk(r, obj, n, NULL);
>  		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements Feifei Wang
@ 2020-09-14  4:31     ` Honnappa Nagarahalli
  0 siblings, 0 replies; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-09-14  4:31 UTC (permalink / raw)
  To: Feifei Wang, Konstantin Ananyev
  Cc: dev, nd, Feifei Wang, stable, Honnappa Nagarahalli, nd

<snip>

> 
> The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of
> elements can be enqueued into the ring.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
Looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  app/test/test_ring.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> 63d44d85e..811adc523 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -822,7 +822,7 @@ test_ring_basic_ex(void)
>  		printf("%u ring entries are now free\n",
>  			rte_ring_free_count(rp));
> 
> -		for (j = 0; j < RING_SIZE; j++) {
> +		for (j = 0; j < RING_SIZE - 1; j++) {
>  			ret = test_ring_enqueue(rp, cur_src, esize[i], 1,
>  				TEST_RING_THREAD_DEF |
> TEST_RING_ELEM_SINGLE);
>  			if (ret != 0) {
> @@ -839,7 +839,7 @@ test_ring_basic_ex(void)
>  			goto fail_test;
>  		}
> 
> -		for (j = 0; j < RING_SIZE; j++) {
> +		for (j = 0; j < RING_SIZE - 1; j++) {
>  			ret = test_ring_dequeue(rp, cur_dst, esize[i], 1,
>  				TEST_RING_THREAD_DEF |
> TEST_RING_ELEM_SINGLE);
>  			if (ret != 0) {
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp
  2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp Feifei Wang
@ 2020-09-14  4:37     ` Honnappa Nagarahalli
  2020-09-14  9:20       ` David Marchand
  0 siblings, 1 reply; 37+ messages in thread
From: Honnappa Nagarahalli @ 2020-09-14  4:37 UTC (permalink / raw)
  To: Feifei Wang, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable, david.marchand, Honnappa Nagarahalli, nd

<snip>

> 
> When using memcmp function to check data, the third param should be the
> size of all elements, rather than the number of the elements.
> 
> Furthermore, do code clean up by moving repeated code inside
> 'test_ring_mem_cmp' function to validate data and print information of
> enqueue/dequeue elements if validation fails.
This patch is fixing 2 things. But only the memcmp issue need to be backported to stable. I would prefer to split this into 2 and mark only the memcmp commit to be backported.

Hi David,
	Do you have a different opinion here?

> 
> Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> ---
>  app/test/test_ring.c | 59 ++++++++++++++++++++------------------------
>  1 file changed, 27 insertions(+), 32 deletions(-)
> 
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c index
> 811adc523..4a2bd39fc 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -258,6 +258,21 @@ test_ring_mem_init(void *obj, unsigned int count, int
> esize)
>  			((uint32_t *)obj)[i] = i;
>  }
> 
> +static int
> +test_ring_mem_cmp(void *src, void *dst, unsigned int size) {
> +	int ret;
> +
> +	ret = memcmp(src, dst, size);
> +	if (ret) {
> +		rte_hexdump(stdout, "src", src, size);
> +		rte_hexdump(stdout, "dst", dst, size);
> +		printf("data after dequeue is not the same\n");
> +	}
> +
> +	return ret;
> +}
> +
>  static void
>  test_ring_print_test_string(const char *istr, unsigned int api_type, int esize)
> { @@ -383,7 +398,7 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
>  	struct rte_ring *r;
>  	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
>  	int ret;
> -	unsigned int i, j;
> +	unsigned int i, j, temp_sz;
>  	int rand;
>  	const unsigned int rsz = RING_SIZE - 1;
> 
> @@ -444,7 +459,11 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
>  			TEST_RING_VERIFY(rte_ring_empty(r));
> 
>  			/* check data */
> -			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
> +			temp_sz = rsz * sizeof(void *);
> +			if (esize[i] != -1)
> +				temp_sz = rsz * esize[i];
> +			TEST_RING_VERIFY(test_ring_mem_cmp(src, dst,
> +						temp_sz) == 0);
>  		}
> 
>  		/* Free memory before test completed */ @@ -538,12 +557,8
> @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
>  		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
>  			goto fail;
> -		}
> 
>  		/* Free memory before test completed */
>  		rte_ring_free(r);
> @@ -614,12 +629,8 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
>  		}
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
>  			goto fail;
> -		}
> 
>  		/* Free memory before test completed */
>  		rte_ring_free(r);
> @@ -747,12 +758,8 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
>  			goto fail;
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
>  			goto fail;
> -		}
> 
>  		/* Free memory before test completed */
>  		rte_ring_free(r);
> @@ -857,12 +864,8 @@ test_ring_basic_ex(void)
>  		}
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_src - src)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_src, src)))
>  			goto fail_test;
> -		}
> 
>  		/* Following tests use the configured flags to decide
>  		 * SP/SC or MP/MC.
> @@ -909,12 +912,8 @@ test_ring_basic_ex(void)
>  		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
>  			goto fail_test;
> -		}
> 
>  		rte_ring_free(rp);
>  		rte_free(src);
> @@ -1047,12 +1046,8 @@ test_ring_with_exact_size(void)
>  		}
> 
>  		/* check data */
> -		if (memcmp(src, dst, cur_dst - dst)) {
> -			rte_hexdump(stdout, "src", src, cur_src - src);
> -			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
> -			printf("data after dequeue is not the same\n");
> +		if (test_ring_mem_cmp(src, dst, RTE_PTR_DIFF(cur_dst, dst)))
>  			goto test_fail;
> -		}
> 
>  		rte_free(src_orig);
>  		rte_free(dst_orig);
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp
  2020-09-14  4:37     ` Honnappa Nagarahalli
@ 2020-09-14  9:20       ` David Marchand
  0 siblings, 0 replies; 37+ messages in thread
From: David Marchand @ 2020-09-14  9:20 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Feifei Wang
  Cc: Konstantin Ananyev, Olivier Matz, dev, nd, stable

On Mon, Sep 14, 2020 at 6:38 AM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
>
> <snip>
>
> >
> > When using memcmp function to check data, the third param should be the
> > size of all elements, rather than the number of the elements.
> >
> > Furthermore, do code clean up by moving repeated code inside
> > 'test_ring_mem_cmp' function to validate data and print information of
> > enqueue/dequeue elements if validation fails.
> This patch is fixing 2 things. But only the memcmp issue need to be backported to stable. I would prefer to split this into 2 and mark only the memcmp commit to be backported.

+1


-- 
David Marchand


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v4 2/7] test/ring: fix wrong parameter passed to the enqueue APIs
       [not found] ` <20200914143350.18650-1-feifei.wang2@arm.com>
@ 2020-09-14 14:33   ` Feifei Wang
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 4/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 5/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-14 14:33 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Gavin Hu, Olivier Matz
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element to ring in the performance test, a pointer
should be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer
to a table of void *pointers.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v4 4/7] test/ring: fix wrong number of enq/deq elements
       [not found] ` <20200914143350.18650-1-feifei.wang2@arm.com>
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 2/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
@ 2020-09-14 14:33   ` Feifei Wang
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 5/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-14 14:33 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev; +Cc: dev, nd, Feifei Wang, stable

The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of
elements can be enqueued into the ring.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 63d44d85e..811adc523 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
 		printf("%u ring entries are now free\n",
 			rte_ring_free_count(rp));
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			ret = test_ring_enqueue(rp, cur_src, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 			if (ret != 0) {
@@ -839,7 +839,7 @@ test_ring_basic_ex(void)
 			goto fail_test;
 		}
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			ret = test_ring_dequeue(rp, cur_dst, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 			if (ret != 0) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v4 5/7] test/ring: fix wrong size used in memcmp
       [not found] ` <20200914143350.18650-1-feifei.wang2@arm.com>
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 2/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
  2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 4/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
@ 2020-09-14 14:33   ` Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-14 14:33 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When using memcmp function to check data, the third param should be the
size of all elements, rather than the number of the elements.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 49 +++++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 811adc523..06498c337 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 			TEST_RING_VERIFY(rte_ring_empty(r));
 
 			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
+			if (esize[i] == -1) {
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * sizeof(void *)) == 0);
+			} else
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * esize[i]) == 0);
 		}
 
 		/* Free memory before test completed */
@@ -538,9 +543,11 @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
 			goto fail;
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -857,9 +868,9 @@ test_ring_basic_ex(void)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_src - src)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_src, src))) {
+			rte_hexdump(stdout, "src", src, RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst, RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail_test;
 		}
@@ -909,9 +920,9 @@ test_ring_basic_ex(void)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src, RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst, RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail_test;
 		}
@@ -1047,9 +1058,9 @@ test_ring_with_exact_size(void)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src, RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst, RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto test_fail;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v5 1/7] test/ring: fix wrong parameter passed to the enqueue APIs
       [not found] ` <20200915062749.21374-1-feifei.wang2@arm.com>
@ 2020-09-15  6:27   ` Feifei Wang
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 3/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-15  6:27 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element to ring in the performance test, a pointer
should be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer
to a table of void *pointers.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v5 2/7] test/ring: fix wrong number of enq/deq elements
       [not found] ` <20200915062749.21374-1-feifei.wang2@arm.com>
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
@ 2020-09-15  6:27   ` Feifei Wang
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 3/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-15  6:27 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev; +Cc: dev, nd, Feifei Wang, stable

The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of
elements can be enqueued into the ring.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 0ae97d341..04bdc9b69 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -811,7 +811,7 @@ test_ring_basic_ex(void)
 		printf("%u ring entries are now free\n",
 			rte_ring_free_count(rp));
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_enqueue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
 			goto fail_test;
 		}
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_dequeue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v5 3/7] test/ring: fix wrong size used in memcmp
       [not found] ` <20200915062749.21374-1-feifei.wang2@arm.com>
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
  2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
@ 2020-09-15  6:27   ` Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-15  6:27 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When using memcmp function to check data, the third param should be the
size of all elements, rather than the number of the elements.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 04bdc9b69..51bae0d48 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 			TEST_RING_VERIFY(rte_ring_empty(r));
 
 			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
+			if (esize[i] == -1) {
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * sizeof(void *)) == 0);
+			} else
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * esize[i]) == 0);
 		}
 
 		/* Free memory before test completed */
@@ -538,9 +543,11 @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
 			goto fail;
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v6 1/7] test/ring: fix wrong parameter passed to the enqueue APIs
       [not found] ` <20200920114856.20697-1-feifei.wang2@arm.com>
@ 2020-09-20 11:48   ` Feifei Wang
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 3/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-20 11:48 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When enqueue one element to ring in the performance test, a pointer
should be passed to rte_ring_[sp|mp]enqueue APIs, not the pointer
to a table of void *pointers.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index aa6ae67ca..d4b15af7c 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -50,11 +50,11 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
 	if ((esize) == -1)
 		switch (api_type) {
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE):
-			return rte_ring_enqueue(r, obj);
+			return rte_ring_enqueue(r, *obj);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_sp_enqueue(r, obj);
+			return rte_ring_sp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE):
-			return rte_ring_mp_enqueue(r, obj);
+			return rte_ring_mp_enqueue(r, *obj);
 		case (TEST_RING_THREAD_DEF | TEST_RING_ELEM_BULK):
 			return rte_ring_enqueue_bulk(r, obj, n, NULL);
 		case (TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK):
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v6 2/7] test/ring: fix wrong number of enq/deq elements
       [not found] ` <20200920114856.20697-1-feifei.wang2@arm.com>
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
@ 2020-09-20 11:48   ` Feifei Wang
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 3/7] test/ring: fix wrong size used in memcmp Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-20 11:48 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev; +Cc: dev, nd, Feifei Wang, stable

The ring capacity is (RING_SIZE - 1), thus only (RING_SIZE - 1) number of
elements can be enqueued into the ring.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 0ae97d341..04bdc9b69 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -811,7 +811,7 @@ test_ring_basic_ex(void)
 		printf("%u ring entries are now free\n",
 			rte_ring_free_count(rp));
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_enqueue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
 			goto fail_test;
 		}
 
-		for (j = 0; j < RING_SIZE; j++) {
+		for (j = 0; j < RING_SIZE - 1; j++) {
 			test_ring_dequeue(rp, obj, esize[i], 1,
 				TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-stable] [PATCH v6 3/7] test/ring: fix wrong size used in memcmp
       [not found] ` <20200920114856.20697-1-feifei.wang2@arm.com>
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
  2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
@ 2020-09-20 11:48   ` Feifei Wang
  2 siblings, 0 replies; 37+ messages in thread
From: Feifei Wang @ 2020-09-20 11:48 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Konstantin Ananyev, Olivier Matz, Gavin Hu
  Cc: dev, nd, Feifei Wang, stable

When using memcmp function to check data, the third param should be the
size of all elements, rather than the number of the elements.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 04bdc9b69..51bae0d48 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -444,7 +444,12 @@ test_ring_burst_bulk_tests1(unsigned int test_idx)
 			TEST_RING_VERIFY(rte_ring_empty(r));
 
 			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
+			if (esize[i] == -1) {
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * sizeof(void *)) == 0);
+			} else
+				TEST_RING_VERIFY(memcmp(src, dst,
+					rsz * esize[i]) == 0);
 		}
 
 		/* Free memory before test completed */
@@ -538,9 +543,11 @@ test_ring_burst_bulk_tests2(unsigned int test_idx)
 		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -614,9 +621,11 @@ test_ring_burst_bulk_tests3(unsigned int test_idx)
 		}
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
@@ -747,9 +756,11 @@ test_ring_burst_bulk_tests4(unsigned int test_idx)
 			goto fail;
 
 		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) {
+			rte_hexdump(stdout, "src", src,
+					RTE_PTR_DIFF(cur_src, src));
+			rte_hexdump(stdout, "dst", dst,
+					RTE_PTR_DIFF(cur_dst, dst));
 			printf("data after dequeue is not the same\n");
 			goto fail;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, back to index

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200729063105.11299-1-feifei.wang2@arm.com>
2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 1/2] ring: fix the misdescription of the param Feifei Wang
2020-07-29 15:59   ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-07-29 16:24     ` Ananyev, Konstantin
2020-07-29 19:34       ` Honnappa Nagarahalli
2020-07-30 10:16     ` [dpdk-stable] 回复: " Feifei Wang
2020-07-31  5:26       ` [dpdk-stable] " Honnappa Nagarahalli
2020-07-29  6:31 ` [dpdk-stable] [PATCH v1 2/2] test/ring: fix wrong param passed to the enqueue APIs Feifei Wang
2020-07-29 13:48   ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-07-29 14:16     ` [dpdk-stable] 回复: " Feifei Wang
2020-07-29 14:21       ` [dpdk-stable] " David Marchand
2020-07-29 15:03         ` [dpdk-stable] 回复: " Feifei Wang
2020-07-29 21:24           ` [dpdk-stable] " Honnappa Nagarahalli
2020-07-30 10:28             ` [dpdk-stable] 回复: " Feifei Wang
2020-07-31  6:25               ` Feifei Wang
     [not found] ` <20200805061421.13037-1-feifei.wang2@arm.com>
2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 1/4] test/ring: fix wrong parameter " Feifei Wang
2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 2/4] test/ring: fix wrong size used in memcmp Feifei Wang
2020-08-26 20:51     ` Honnappa Nagarahalli
2020-08-27  9:05       ` [dpdk-stable] 回复: " Feifei Wang
2020-08-05  6:14   ` [dpdk-stable] [PATCH v2 3/4] test/ring: fix the wrong number of enq/deq elements Feifei Wang
2020-08-26 20:51     ` Honnappa Nagarahalli
2020-08-27  8:54       ` [dpdk-stable] 回复: " Feifei Wang
     [not found] ` <20200911161002.19816-1-feifei.wang2@arm.com>
2020-09-11 16:09   ` [dpdk-stable] [PATCH v3 2/6] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
2020-09-14  4:28     ` Honnappa Nagarahalli
2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 4/6] test/ring: fix wrong number of enq/deq elements Feifei Wang
2020-09-14  4:31     ` Honnappa Nagarahalli
2020-09-11 16:10   ` [dpdk-stable] [PATCH v3 5/6] test/ring: fix wrong size used in memcmp Feifei Wang
2020-09-14  4:37     ` Honnappa Nagarahalli
2020-09-14  9:20       ` David Marchand
     [not found] ` <20200914143350.18650-1-feifei.wang2@arm.com>
2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 2/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 4/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
2020-09-14 14:33   ` [dpdk-stable] [PATCH v4 5/7] test/ring: fix wrong size used in memcmp Feifei Wang
     [not found] ` <20200915062749.21374-1-feifei.wang2@arm.com>
2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
2020-09-15  6:27   ` [dpdk-stable] [PATCH v5 3/7] test/ring: fix wrong size used in memcmp Feifei Wang
     [not found] ` <20200920114856.20697-1-feifei.wang2@arm.com>
2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 1/7] test/ring: fix wrong parameter passed to the enqueue APIs Feifei Wang
2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 2/7] test/ring: fix wrong number of enq/deq elements Feifei Wang
2020-09-20 11:48   ` [dpdk-stable] [PATCH v6 3/7] test/ring: fix wrong size used in memcmp Feifei Wang

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/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 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


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