DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test: add delay time in test alarm
@ 2017-03-21  6:03 Qiming Yang
  2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
  0 siblings, 1 reply; 10+ messages in thread
From: Qiming Yang @ 2017-03-21  6:03 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang

Because accuracy of timing to the microsecond is not guaranteed
in rte_eal_alarm_set, this function will not be called before
the requested time, but may be called a period of time
afterwards which can not be calculated. In order to ensure
test alarm running success, this patch added the delay time
before check the flag.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 test/test/test_alarm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c
index ecb2f6d..ad4e908 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -169,7 +169,9 @@
 		printf("Error, cancelling head-of-list leads to premature callback\n");
 		return -1;
 	}
-	rte_delay_ms(10);
+	int count = 0;
+	while (flag != 2 && count ++ < 6)
+		rte_delay_ms(10);
 	if (flag != 2) {
 		printf("Error - expected callback not called\n");
 		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
@@ -212,7 +214,7 @@
 		printf("fail to set alarm callback\n");
 		return -1;
 	}
-	while (flag == 0 && count ++ < 6)
+	while (flag == 0 && count ++ < 20)
 		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
 
 	if (flag == 0){
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v2] test: add delay time in test alarm
  2017-03-21  6:03 [dpdk-dev] [PATCH] test: add delay time in test alarm Qiming Yang
@ 2017-05-05  2:17 ` Qiming Yang
  2017-05-05  6:28   ` Chen, Jing D
  2017-06-20  3:24   ` [dpdk-dev] [PATCH v3] " Qiming Yang
  0 siblings, 2 replies; 10+ messages in thread
From: Qiming Yang @ 2017-05-05  2:17 UTC (permalink / raw)
  To: dev; +Cc: jing.d.chen, jingjing.wu, Qiming Yang

Because accuracy of timing to the microsecond is not guaranteed
in rte_eal_alarm_set, this function will not be called before
the requested time, but may be called a period of time
afterwards which can not be calculated. In order to ensure
test alarm running success, this patch added the delay time
before check the flag.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v2 changes:
* fixed coding style problems
---
---
 test/test/test_alarm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c
index ecb2f6d..cbae1a0 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -96,6 +96,7 @@ static int
 test_multi_alarms(void)
 {
 	int rm_count = 0;
+	int count = 0;
 	cb_count.cnt = 0;
 
 	printf("Expect 6 callbacks in order...\n");
@@ -169,7 +170,10 @@ test_multi_alarms(void)
 		printf("Error, cancelling head-of-list leads to premature callback\n");
 		return -1;
 	}
-	rte_delay_ms(10);
+
+	while (flag != 2 && count++ < 6)
+		rte_delay_ms(10);
+
 	if (flag != 2) {
 		printf("Error - expected callback not called\n");
 		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
@@ -212,7 +216,7 @@ test_alarm(void)
 		printf("fail to set alarm callback\n");
 		return -1;
 	}
-	while (flag == 0 && count ++ < 6)
+	while (flag == 0 && count++ < 20)
 		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
 
 	if (flag == 0){
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] test: add delay time in test alarm
  2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
@ 2017-05-05  6:28   ` Chen, Jing D
  2017-05-16  3:15     ` Yang, Qiming
  2017-06-20  3:24   ` [dpdk-dev] [PATCH v3] " Qiming Yang
  1 sibling, 1 reply; 10+ messages in thread
From: Chen, Jing D @ 2017-05-05  6:28 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Wu, Jingjing

Hi, 
 
> diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index
> ecb2f6d..cbae1a0 100644
> --- a/test/test/test_alarm.c
> +++ b/test/test/test_alarm.c
> @@ -96,6 +96,7 @@ static int
>  test_multi_alarms(void)
>  {
>  	int rm_count = 0;
> +	int count = 0;
>  	cb_count.cnt = 0;
> 
>  	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +170,10 @@
> test_multi_alarms(void)
>  		printf("Error, cancelling head-of-list leads to premature
> callback\n");
>  		return -1;
>  	}
> -	rte_delay_ms(10);
> +
> +	while (flag != 2 && count++ < 6)
> +		rte_delay_ms(10);
> +
>  	if (flag != 2) {
>  		printf("Error - expected callback not called\n");
>  		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
> @@ -212,7 +216,7 @@ test_alarm(void)
>  		printf("fail to set alarm callback\n");
>  		return -1;
>  	}
> -	while (flag == 0 && count ++ < 6)
> +	while (flag == 0 && count++ < 20)
>  		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
> 

What's the criteria to delay 20* RTE_TEST_CHECK_PERIOD ms? Add more comments?

>  	if (flag == 0){
> --
> 2.7.4

Overall comment is to replace numeric with macro.

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

* Re: [dpdk-dev] [PATCH v2] test: add delay time in test alarm
  2017-05-05  6:28   ` Chen, Jing D
@ 2017-05-16  3:15     ` Yang, Qiming
  0 siblings, 0 replies; 10+ messages in thread
From: Yang, Qiming @ 2017-05-16  3:15 UTC (permalink / raw)
  To: Chen, Jing D, dev; +Cc: Wu, Jingjing

Hi,

> -----Original Message-----
> From: Chen, Jing D
> Sent: Friday, May 5, 2017 2:29 PM
> To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>
> Subject: RE: [PATCH v2] test: add delay time in test alarm
> 
> Hi,
> 
> > diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index
> > ecb2f6d..cbae1a0 100644
> > --- a/test/test/test_alarm.c
> > +++ b/test/test/test_alarm.c
> > @@ -96,6 +96,7 @@ static int
> >  test_multi_alarms(void)
> >  {
> >  	int rm_count = 0;
> > +	int count = 0;
> >  	cb_count.cnt = 0;
> >
> >  	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +170,10 @@
> > test_multi_alarms(void)
> >  		printf("Error, cancelling head-of-list leads to premature
> > callback\n");
> >  		return -1;
> >  	}
> > -	rte_delay_ms(10);
> > +
> > +	while (flag != 2 && count++ < 6)
> > +		rte_delay_ms(10);

The count can be replaced with macro, but the delay 10 ms is based on the alarm time set before.
rte_eal_alarm_set(10 * US_PER_MS, test_remove_in_callback, (void *)1);

> > +
> >  	if (flag != 2) {
> >  		printf("Error - expected callback not called\n");
> >  		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
> @@
> > -212,7 +216,7 @@ test_alarm(void)
> >  		printf("fail to set alarm callback\n");
> >  		return -1;
> >  	}
> > -	while (flag == 0 && count ++ < 6)
> > +	while (flag == 0 && count++ < 20)
> >  		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
> >
> 
> What's the criteria to delay 20* RTE_TEST_CHECK_PERIOD ms? Add more
> comments?
> 
> >  	if (flag == 0){
> > --
> > 2.7.4
> 
> Overall comment is to replace numeric with macro.

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

* [dpdk-dev] [PATCH v3] test: add delay time in test alarm
  2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
  2017-05-05  6:28   ` Chen, Jing D
@ 2017-06-20  3:24   ` Qiming Yang
  2017-07-06  8:28     ` Chen, Jing D
  1 sibling, 1 reply; 10+ messages in thread
From: Qiming Yang @ 2017-06-20  3:24 UTC (permalink / raw)
  To: dev; +Cc: jing.d.chen, jingjing.wu, Qiming Yang

Because accuracy of timing to the microsecond is not guaranteed
in rte_eal_alarm_set, this function will not be called before
the requested time, but may be called a period of time
afterwards which can not be calculated. In order to ensure
test alarm running success, this patch added the delay time
before check the flag.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v2 changes:
* fixed coding style problems
v3 changes:
* replaced the numeric by macro
---
---
 test/test/test_alarm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c
index ecb2f6d..40f55b5 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -47,6 +47,7 @@
 
 #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
 #define RTE_TEST_CHECK_PERIOD   3 /* ms */
+#define RTE_TEST_MAX_REPEAT    20
 
 static volatile int flag;
 
@@ -96,6 +97,7 @@ static int
 test_multi_alarms(void)
 {
 	int rm_count = 0;
+	int count = 0;
 	cb_count.cnt = 0;
 
 	printf("Expect 6 callbacks in order...\n");
@@ -169,7 +171,10 @@ test_multi_alarms(void)
 		printf("Error, cancelling head-of-list leads to premature callback\n");
 		return -1;
 	}
-	rte_delay_ms(10);
+
+	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
+		rte_delay_ms(10);
+
 	if (flag != 2) {
 		printf("Error - expected callback not called\n");
 		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
@@ -212,7 +217,7 @@ test_alarm(void)
 		printf("fail to set alarm callback\n");
 		return -1;
 	}
-	while (flag == 0 && count ++ < 6)
+	while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
 		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
 
 	if (flag == 0){
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v3] test: add delay time in test alarm
  2017-06-20  3:24   ` [dpdk-dev] [PATCH v3] " Qiming Yang
@ 2017-07-06  8:28     ` Chen, Jing D
  2017-07-07  4:35       ` Yang, Qiming
  0 siblings, 1 reply; 10+ messages in thread
From: Chen, Jing D @ 2017-07-06  8:28 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Wu, Jingjing


+	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
+		rte_delay_ms(10);

Why you don't replace "2" and "10" with macro?

-----Original Message-----
From: Yang, Qiming 
Sent: Tuesday, June 20, 2017 11:24 AM
To: dev@dpdk.org
Cc: Chen, Jing D <jing.d.chen@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>
Subject: [PATCH v3] test: add delay time in test alarm

Because accuracy of timing to the microsecond is not guaranteed in rte_eal_alarm_set, this function will not be called before the requested time, but may be called a period of time afterwards which can not be calculated. In order to ensure test alarm running success, this patch added the delay time before check the flag.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v2 changes:
* fixed coding style problems
v3 changes:
* replaced the numeric by macro
---
---
 test/test/test_alarm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index ecb2f6d..40f55b5 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -47,6 +47,7 @@
 
 #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
 #define RTE_TEST_CHECK_PERIOD   3 /* ms */
+#define RTE_TEST_MAX_REPEAT    20
 
 static volatile int flag;
 
@@ -96,6 +97,7 @@ static int
 test_multi_alarms(void)
 {
 	int rm_count = 0;
+	int count = 0;
 	cb_count.cnt = 0;
 
 	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +171,10 @@ test_multi_alarms(void)
 		printf("Error, cancelling head-of-list leads to premature callback\n");
 		return -1;
 	}
-	rte_delay_ms(10);
+
+	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
+		rte_delay_ms(10);
+
 	if (flag != 2) {
 		printf("Error - expected callback not called\n");
 		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1); @@ -212,7 +217,7 @@ test_alarm(void)
 		printf("fail to set alarm callback\n");
 		return -1;
 	}
-	while (flag == 0 && count ++ < 6)
+	while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
 		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
 
 	if (flag == 0){
--
2.7.4

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

* Re: [dpdk-dev] [PATCH v3] test: add delay time in test alarm
  2017-07-06  8:28     ` Chen, Jing D
@ 2017-07-07  4:35       ` Yang, Qiming
  2017-07-12  1:31         ` Chen, Jing D
  0 siblings, 1 reply; 10+ messages in thread
From: Yang, Qiming @ 2017-07-07  4:35 UTC (permalink / raw)
  To: Chen, Jing D, dev; +Cc: Wu, Jingjing

Hi, Mark
"2" and "10" is the special number in this test case, not a general number.
        /* Test that we cannot cancel an alarm from within the callback itself
         * Also test that we can cancel head-of-line callbacks ok.*/
        flag = 0;
        recursive_error = 0;
        rte_eal_alarm_set(10 * US_PER_MS, test_remove_in_callback, (void *)1);
        rte_eal_alarm_set(20 * US_PER_MS, test_remove_in_callback, (void *)2);


> -----Original Message-----
> From: Chen, Jing D
> Sent: Thursday, July 6, 2017 4:29 PM
> To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>
> Subject: RE: [PATCH v3] test: add delay time in test alarm
> 
> 
> +	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
> +		rte_delay_ms(10);
> 
> Why you don't replace "2" and "10" with macro?
> 
> -----Original Message-----
> From: Yang, Qiming
> Sent: Tuesday, June 20, 2017 11:24 AM
> To: dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Yang, Qiming <qiming.yang@intel.com>
> Subject: [PATCH v3] test: add delay time in test alarm
> 
> Because accuracy of timing to the microsecond is not guaranteed in
> rte_eal_alarm_set, this function will not be called before the requested time,
> but may be called a period of time afterwards which can not be calculated. In
> order to ensure test alarm running success, this patch added the delay time
> before check the flag.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> v2 changes:
> * fixed coding style problems
> v3 changes:
> * replaced the numeric by macro
> ---
> ---
>  test/test/test_alarm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index
> ecb2f6d..40f55b5 100644
> --- a/test/test/test_alarm.c
> +++ b/test/test/test_alarm.c
> @@ -47,6 +47,7 @@
> 
>  #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
>  #define RTE_TEST_CHECK_PERIOD   3 /* ms */
> +#define RTE_TEST_MAX_REPEAT    20
> 
>  static volatile int flag;
> 
> @@ -96,6 +97,7 @@ static int
>  test_multi_alarms(void)
>  {
>  	int rm_count = 0;
> +	int count = 0;
>  	cb_count.cnt = 0;
> 
>  	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +171,10 @@
> test_multi_alarms(void)
>  		printf("Error, cancelling head-of-list leads to premature
> callback\n");
>  		return -1;
>  	}
> -	rte_delay_ms(10);
> +
> +	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
> +		rte_delay_ms(10);
> +
>  	if (flag != 2) {
>  		printf("Error - expected callback not called\n");
>  		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
> @@ -212,7 +217,7 @@ test_alarm(void)
>  		printf("fail to set alarm callback\n");
>  		return -1;
>  	}
> -	while (flag == 0 && count ++ < 6)
> +	while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
>  		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
> 
>  	if (flag == 0){
> --
> 2.7.4

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

* Re: [dpdk-dev] [PATCH v3] test: add delay time in test alarm
  2017-07-07  4:35       ` Yang, Qiming
@ 2017-07-12  1:31         ` Chen, Jing D
  2017-07-14  5:51           ` [dpdk-dev] FW: " Yang, Qiming
  2017-07-14  9:36           ` [dpdk-dev] " Thomas Monjalon
  0 siblings, 2 replies; 10+ messages in thread
From: Chen, Jing D @ 2017-07-12  1:31 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Wu, Jingjing


> >
> > -----Original Message-----
> > From: Yang, Qiming
> > Sent: Tuesday, June 20, 2017 11:24 AM
> > To: dev@dpdk.org
> > Cc: Chen, Jing D <jing.d.chen@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> > Subject: [PATCH v3] test: add delay time in test alarm
> >
> > Because accuracy of timing to the microsecond is not guaranteed in
> > rte_eal_alarm_set, this function will not be called before the
> > requested time, but may be called a period of time afterwards which
> > can not be calculated. In order to ensure test alarm running success,
> > this patch added the delay time before check the flag.
> >
> > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> > ---
> > v2 changes:
> > * fixed coding style problems
> > v3 changes:
> > * replaced the numeric by macro
> > ---
> > ---
> >  test/test/test_alarm.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index
> > ecb2f6d..40f55b5 100644
> > --- a/test/test/test_alarm.c
> > +++ b/test/test/test_alarm.c
> > @@ -47,6 +47,7 @@
> >
> >  #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
> >  #define RTE_TEST_CHECK_PERIOD   3 /* ms */
> > +#define RTE_TEST_MAX_REPEAT    20
> >
> >  static volatile int flag;
> >
> > @@ -96,6 +97,7 @@ static int
> >  test_multi_alarms(void)
> >  {
> >  	int rm_count = 0;
> > +	int count = 0;
> >  	cb_count.cnt = 0;
> >
> >  	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +171,10 @@
> > test_multi_alarms(void)
> >  		printf("Error, cancelling head-of-list leads to premature
> > callback\n");
> >  		return -1;
> >  	}
> > -	rte_delay_ms(10);
> > +
> > +	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
> > +		rte_delay_ms(10);
> > +
> >  	if (flag != 2) {
> >  		printf("Error - expected callback not called\n");
> >  		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
> @@
> > -212,7 +217,7 @@ test_alarm(void)
> >  		printf("fail to set alarm callback\n");
> >  		return -1;
> >  	}
> > -	while (flag == 0 && count ++ < 6)
> > +	while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
> >  		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
> >
> >  	if (flag == 0){
> > --
> > 2.7.4

Acked-by : Jing Chen <jing.d.chen@intel.com>

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

* [dpdk-dev] FW: [PATCH v3] test: add delay time in test alarm
  2017-07-12  1:31         ` Chen, Jing D
@ 2017-07-14  5:51           ` Yang, Qiming
  2017-07-14  9:36           ` [dpdk-dev] " Thomas Monjalon
  1 sibling, 0 replies; 10+ messages in thread
From: Yang, Qiming @ 2017-07-14  5:51 UTC (permalink / raw)
  To: thomas, dev; +Cc: Chen, Jing D

Hi, Thomas

Can this patch be applied?

Qiming
> -----Original Message-----
> From: Chen, Jing D
> Sent: Wednesday, July 12, 2017 9:31 AM
> To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>
> Subject: RE: [PATCH v3] test: add delay time in test alarm
> 
> 
> > >
> > > -----Original Message-----
> > > From: Yang, Qiming
> > > Sent: Tuesday, June 20, 2017 11:24 AM
> > > To: dev@dpdk.org
> > > Cc: Chen, Jing D <jing.d.chen@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> > > Subject: [PATCH v3] test: add delay time in test alarm
> > >
> > > Because accuracy of timing to the microsecond is not guaranteed in
> > > rte_eal_alarm_set, this function will not be called before the
> > > requested time, but may be called a period of time afterwards which
> > > can not be calculated. In order to ensure test alarm running
> > > success, this patch added the delay time before check the flag.
> > >
> > > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> > > ---
> > > v2 changes:
> > > * fixed coding style problems
> > > v3 changes:
> > > * replaced the numeric by macro
> > > ---
> > > ---
> > >  test/test/test_alarm.c | 9 +++++++--
> > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index
> > > ecb2f6d..40f55b5 100644
> > > --- a/test/test/test_alarm.c
> > > +++ b/test/test/test_alarm.c
> > > @@ -47,6 +47,7 @@
> > >
> > >  #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */
> > >  #define RTE_TEST_CHECK_PERIOD   3 /* ms */
> > > +#define RTE_TEST_MAX_REPEAT    20
> > >
> > >  static volatile int flag;
> > >
> > > @@ -96,6 +97,7 @@ static int
> > >  test_multi_alarms(void)
> > >  {
> > >  	int rm_count = 0;
> > > +	int count = 0;
> > >  	cb_count.cnt = 0;
> > >
> > >  	printf("Expect 6 callbacks in order...\n"); @@ -169,7 +171,10 @@
> > > test_multi_alarms(void)
> > >  		printf("Error, cancelling head-of-list leads to premature
> > > callback\n");
> > >  		return -1;
> > >  	}
> > > -	rte_delay_ms(10);
> > > +
> > > +	while (flag != 2 && count++ < RTE_TEST_MAX_REPEAT)
> > > +		rte_delay_ms(10);
> > > +
> > >  	if (flag != 2) {
> > >  		printf("Error - expected callback not called\n");
> > >  		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
> > @@
> > > -212,7 +217,7 @@ test_alarm(void)
> > >  		printf("fail to set alarm callback\n");
> > >  		return -1;
> > >  	}
> > > -	while (flag == 0 && count ++ < 6)
> > > +	while (flag == 0 && count++ < RTE_TEST_MAX_REPEAT)
> > >  		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
> > >
> > >  	if (flag == 0){
> > > --
> > > 2.7.4
> 
> Acked-by : Jing Chen <jing.d.chen@intel.com>

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

* Re: [dpdk-dev] [PATCH v3] test: add delay time in test alarm
  2017-07-12  1:31         ` Chen, Jing D
  2017-07-14  5:51           ` [dpdk-dev] FW: " Yang, Qiming
@ 2017-07-14  9:36           ` Thomas Monjalon
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2017-07-14  9:36 UTC (permalink / raw)
  To: Yang, Qiming; +Cc: dev, Chen, Jing D, Wu, Jingjing

> > > Because accuracy of timing to the microsecond is not guaranteed in
> > > rte_eal_alarm_set, this function will not be called before the
> > > requested time, but may be called a period of time afterwards which
> > > can not be calculated. In order to ensure test alarm running success,
> > > this patch added the delay time before check the flag.
> > >
> > > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> 
> Acked-by : Jing Chen <jing.d.chen@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-07-14  9:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21  6:03 [dpdk-dev] [PATCH] test: add delay time in test alarm Qiming Yang
2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
2017-05-05  6:28   ` Chen, Jing D
2017-05-16  3:15     ` Yang, Qiming
2017-06-20  3:24   ` [dpdk-dev] [PATCH v3] " Qiming Yang
2017-07-06  8:28     ` Chen, Jing D
2017-07-07  4:35       ` Yang, Qiming
2017-07-12  1:31         ` Chen, Jing D
2017-07-14  5:51           ` [dpdk-dev] FW: " Yang, Qiming
2017-07-14  9:36           ` [dpdk-dev] " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).