diff mbox series

[v2,4/7] test/rcu: use size_t instead of int

Message ID 20191008211220.31586-5-honnappa.nagarahalli@arm.com
State New
Headers show
Series typo, doc, simple fixes and some optimizations | expand

Commit Message

Honnappa Nagarahalli Oct. 8, 2019, 9:12 p.m. UTC
Variables used to store the return value of rte_rcu_qsbr_get_memsize
in variables of type 'int'. The variables are of type 'size_t' now.

Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Reviewed-by: Gavin Hu <gavin.hu@arm.com>

---
 app/test/test_rcu_qsbr.c      |  4 ++--
 app/test/test_rcu_qsbr_perf.c | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

-- 
2.17.1

Comments

David Marchand Oct. 21, 2019, 7:19 p.m. UTC | #1
On Tue, Oct 8, 2019 at 11:12 PM Honnappa Nagarahalli
<honnappa.nagarahalli@arm.com> wrote:
>

> Variables used to store the return value of rte_rcu_qsbr_get_memsize

> in variables of type 'int'. The variables are of type 'size_t' now.


Added a comment on the two cases we have here: the uint32_t storage
are fine while the int ones were an issue.


>

> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")

> Cc: stable@dpdk.org

>

> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> Reviewed-by: Gavin Hu <gavin.hu@arm.com>

> ---

>  app/test/test_rcu_qsbr.c      |  4 ++--

>  app/test/test_rcu_qsbr_perf.c | 11 ++++++-----

>  2 files changed, 8 insertions(+), 7 deletions(-)

>

> diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c

> index d1b9e46a2..2f71ec6ad 100644

> --- a/app/test/test_rcu_qsbr.c

> +++ b/app/test/test_rcu_qsbr.c

> @@ -52,7 +52,7 @@ static int

>  alloc_rcu(void)

>  {

>         int i;

> -       uint32_t sz;

> +       size_t sz;

>

>         sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);

>

> @@ -81,7 +81,7 @@ free_rcu(void)

>  static int

>  test_rcu_qsbr_get_memsize(void)

>  {

> -       uint32_t sz;

> +       size_t sz;

>

>         printf("\nTest rte_rcu_qsbr_thread_register()\n");

>

> diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c

> index cb2d177b7..280f1811f 100644

> --- a/app/test/test_rcu_qsbr_perf.c

> +++ b/app/test/test_rcu_qsbr_perf.c

> @@ -125,7 +125,7 @@ test_rcu_qsbr_writer_perf(void *arg)

>  static int

>  test_rcu_qsbr_perf(void)

>  {

> -       int sz;

> +       size_t sz;

>         unsigned int i, tmp_num_cores;

>

>         writer_done = 0;

> @@ -188,7 +188,7 @@ test_rcu_qsbr_perf(void)

>  static int

>  test_rcu_qsbr_rperf(void)

>  {

> -       int sz;

> +       size_t sz;

>         unsigned int i, tmp_num_cores;

>

>         rte_atomic64_clear(&updates);

> @@ -234,7 +234,7 @@ test_rcu_qsbr_rperf(void)

>  static int

>  test_rcu_qsbr_wperf(void)

>  {

> -       int sz;

> +       size_t sz;

>         unsigned int i;

>

>         rte_atomic64_clear(&checks);

> @@ -379,7 +379,7 @@ static int

>  test_rcu_qsbr_sw_sv_1qs(void)

>  {

>         uint64_t token, begin, cycles;

> -       int sz;

> +       size_t sz;

>         unsigned int i, j, tmp_num_cores;

>         int32_t pos;

>

> @@ -498,7 +498,8 @@ static int

>  test_rcu_qsbr_sw_sv_1qs_non_blocking(void)

>  {

>         uint64_t token, begin, cycles;

> -       int ret, sz;

> +       int ret;

> +       size_t sz;

>         unsigned int i, j, tmp_num_cores;

>         int32_t pos;

>

> --

> 2.17.1

>



--
David Marchand
diff mbox series

Patch

diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
index d1b9e46a2..2f71ec6ad 100644
--- a/app/test/test_rcu_qsbr.c
+++ b/app/test/test_rcu_qsbr.c
@@ -52,7 +52,7 @@  static int
 alloc_rcu(void)
 {
 	int i;
-	uint32_t sz;
+	size_t sz;
 
 	sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
 
@@ -81,7 +81,7 @@  free_rcu(void)
 static int
 test_rcu_qsbr_get_memsize(void)
 {
-	uint32_t sz;
+	size_t sz;
 
 	printf("\nTest rte_rcu_qsbr_thread_register()\n");
 
diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
index cb2d177b7..280f1811f 100644
--- a/app/test/test_rcu_qsbr_perf.c
+++ b/app/test/test_rcu_qsbr_perf.c
@@ -125,7 +125,7 @@  test_rcu_qsbr_writer_perf(void *arg)
 static int
 test_rcu_qsbr_perf(void)
 {
-	int sz;
+	size_t sz;
 	unsigned int i, tmp_num_cores;
 
 	writer_done = 0;
@@ -188,7 +188,7 @@  test_rcu_qsbr_perf(void)
 static int
 test_rcu_qsbr_rperf(void)
 {
-	int sz;
+	size_t sz;
 	unsigned int i, tmp_num_cores;
 
 	rte_atomic64_clear(&updates);
@@ -234,7 +234,7 @@  test_rcu_qsbr_rperf(void)
 static int
 test_rcu_qsbr_wperf(void)
 {
-	int sz;
+	size_t sz;
 	unsigned int i;
 
 	rte_atomic64_clear(&checks);
@@ -379,7 +379,7 @@  static int
 test_rcu_qsbr_sw_sv_1qs(void)
 {
 	uint64_t token, begin, cycles;
-	int sz;
+	size_t sz;
 	unsigned int i, j, tmp_num_cores;
 	int32_t pos;
 
@@ -498,7 +498,8 @@  static int
 test_rcu_qsbr_sw_sv_1qs_non_blocking(void)
 {
 	uint64_t token, begin, cycles;
-	int ret, sz;
+	int ret;
+	size_t sz;
 	unsigned int i, j, tmp_num_cores;
 	int32_t pos;