[v2] app/test: fix to prevent zcd gcc compile error
Checks
Commit Message
When DPDK is compiled with gcc < 9 with the optimization level set to 1
gcc sees zcd in test_ring.h as possibly being uninitialised. To correct
this error if statements from _st_ring_dequeue_bulk and
_st_ring_enqueue_bulk were corrected within test_ring_mt_peek_stress_zc.c
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
---
v2: Moved from initialising zcd to changing if statements within
test_ring_mt_peek_stress_zc.c following list feedback as the
original method used may have masked errors within the library.
---
app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
<snip>
>
> When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc
> sees zcd in test_ring.h as possibly being uninitialised. To correct this error if
> statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were
> corrected within test_ring_mt_peek_stress_zc.c
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Thank you Conor, looks good.
Review-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>
> ---
>
> v2: Moved from initialising zcd to changing if statements within
> test_ring_mt_peek_stress_zc.c following list feedback as the
> original method used may have masked errors within the library.
> ---
> app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/app/test/test_ring_mt_peek_stress_zc.c
> b/app/test/test_ring_mt_peek_stress_zc.c
> index 7e0bd511a7..85f0262ba0 100644
> --- a/app/test/test_ring_mt_peek_stress_zc.c
> +++ b/app/test/test_ring_mt_peek_stress_zc.c
> @@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
> uint32_t n,
> struct rte_ring_zc_data zcd;
>
> m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
> - n = (m == n) ? n : 0;
> - if (n != 0) {
> + if (m != 0) {
> /* Copy the data from the ring */
> test_ring_copy_from(&zcd, obj, -1, n);
> rte_ring_dequeue_zc_finish(r, n);
> @@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
> *obj, uint32_t n,
> struct rte_ring_zc_data zcd;
>
> m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
> - n = (m == n) ? n : 0;
> - if (n != 0) {
> + if (m != 0) {
> /* Copy the data from the ring */
> test_ring_copy_to(&zcd, obj, -1, n);
> rte_ring_enqueue_zc_finish(r, n);
> --
> 2.25.1
> -----Original Message-----
> From: Conor Walsh <conor.walsh@intel.com>
> Sent: Tuesday, November 10, 2020 5:03 AM
> To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> konstantin.ananyev@intel.com
> Cc: dev@dpdk.org; linglix.chen@intel.com; Conor Walsh
> <conor.walsh@intel.com>
> Subject: [PATCH v2] app/test: fix to prevent zcd gcc compile error
>
> When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc
> sees zcd in test_ring.h as possibly being uninitialised. To correct this error if
> statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were
> corrected within test_ring_mt_peek_stress_zc.c
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>
> ---
>
> v2: Moved from initialising zcd to changing if statements within
> test_ring_mt_peek_stress_zc.c following list feedback as the
> original method used may have masked errors within the library.
> ---
> app/test/test_ring_mt_peek_stress_zc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/app/test/test_ring_mt_peek_stress_zc.c
> b/app/test/test_ring_mt_peek_stress_zc.c
> index 7e0bd511a7..85f0262ba0 100644
> --- a/app/test/test_ring_mt_peek_stress_zc.c
> +++ b/app/test/test_ring_mt_peek_stress_zc.c
> @@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj,
> uint32_t n,
> struct rte_ring_zc_data zcd;
>
> m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
> - n = (m == n) ? n : 0;
> - if (n != 0) {
> + if (m != 0) {
> /* Copy the data from the ring */
> test_ring_copy_from(&zcd, obj, -1, n);
> rte_ring_dequeue_zc_finish(r, n);
> @@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const
> *obj, uint32_t n,
> struct rte_ring_zc_data zcd;
>
> m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
> - n = (m == n) ? n : 0;
> - if (n != 0) {
> + if (m != 0) {
> /* Copy the data from the ring */
> test_ring_copy_to(&zcd, obj, -1, n);
> rte_ring_enqueue_zc_finish(r, n);
> --
> 2.25.1
On Wed, Nov 11, 2020 at 5:18 PM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
> > -----Original Message-----
> > From: Conor Walsh <conor.walsh@intel.com>
> > Sent: Tuesday, November 10, 2020 5:03 AM
> > To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> > konstantin.ananyev@intel.com
> > Cc: dev@dpdk.org; linglix.chen@intel.com; Conor Walsh
> > <conor.walsh@intel.com>
> > Subject: [PATCH v2] app/test: fix to prevent zcd gcc compile error
> >
> > When DPDK is compiled with gcc < 9 with the optimization level set to 1 gcc
> > sees zcd in test_ring.h as possibly being uninitialised. To correct this error if
> > statements from _st_ring_dequeue_bulk and _st_ring_enqueue_bulk were
> > corrected within test_ring_mt_peek_stress_zc.c
Fixes: f72299fd157d ("test/ring: add stress tests for zero copy API")
> >
> > Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Updated title, and applied, thanks.
@@ -14,8 +14,7 @@ _st_ring_dequeue_bulk(struct rte_ring *r, void **obj, uint32_t n,
struct rte_ring_zc_data zcd;
m = rte_ring_dequeue_zc_bulk_start(r, n, &zcd, avail);
- n = (m == n) ? n : 0;
- if (n != 0) {
+ if (m != 0) {
/* Copy the data from the ring */
test_ring_copy_from(&zcd, obj, -1, n);
rte_ring_dequeue_zc_finish(r, n);
@@ -32,8 +31,7 @@ _st_ring_enqueue_bulk(struct rte_ring *r, void * const *obj, uint32_t n,
struct rte_ring_zc_data zcd;
m = rte_ring_enqueue_zc_bulk_start(r, n, &zcd, free);
- n = (m == n) ? n : 0;
- if (n != 0) {
+ if (m != 0) {
/* Copy the data from the ring */
test_ring_copy_to(&zcd, obj, -1, n);
rte_ring_enqueue_zc_finish(r, n);