[v7,3/3] test/event: update periodic event timer tests
Checks
Commit Message
This patch updates the software timer adapter tests to
configure and use periodic event timers.
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
app/test/test_event_timer_adapter.c | 41 ++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 4 deletions(-)
Comments
On Wed, Sep 14, 2022 at 9:03 PM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> This patch updates the software timer adapter tests to
> configure and use periodic event timers.
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
> app/test/test_event_timer_adapter.c | 41 ++++++++++++++++++++++++++---
Applied 1/3 and 3/3 to dpdk-next-net-eventdev/for-main. Thanks
> 1 file changed, 37 insertions(+), 4 deletions(-)
>
> diff --git a/app/test/test_event_timer_adapter.c b/app/test/test_event_timer_adapter.c
> index d6170bb589..654c412836 100644
> --- a/app/test/test_event_timer_adapter.c
> +++ b/app/test/test_event_timer_adapter.c
> @@ -386,11 +386,22 @@ timdev_setup_msec(void)
> static int
> timdev_setup_msec_periodic(void)
> {
> + uint32_t caps = 0;
> + uint64_t max_tmo_ns;
> +
> uint64_t flags = RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES |
> RTE_EVENT_TIMER_ADAPTER_F_PERIODIC;
>
> + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
> + "failed to get adapter capabilities");
> +
> + if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
> + max_tmo_ns = 0;
> + else
> + max_tmo_ns = 180 * NSECPERSEC;
> +
> /* Periodic mode with 100 ms resolution */
> - return _timdev_setup(0, NSECPERSEC / 10, flags);
> + return _timdev_setup(max_tmo_ns, NSECPERSEC / 10, flags);
> }
>
> static int
> @@ -409,7 +420,7 @@ timdev_setup_sec_periodic(void)
> RTE_EVENT_TIMER_ADAPTER_F_PERIODIC;
>
> /* Periodic mode with 1 sec resolution */
> - return _timdev_setup(0, NSECPERSEC, flags);
> + return _timdev_setup(180 * NSECPERSEC, NSECPERSEC, flags);
> }
>
> static int
> @@ -561,12 +572,23 @@ test_timer_arm(void)
> static inline int
> test_timer_arm_periodic(void)
> {
> + uint32_t caps = 0;
> + uint32_t timeout_count = 0;
> +
> TEST_ASSERT_SUCCESS(_arm_timers(1, MAX_TIMERS),
> "Failed to arm timers");
> /* With a resolution of 100ms and wait time of 1sec,
> * there will be 10 * MAX_TIMERS periodic timer triggers.
> */
> - TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, 10 * MAX_TIMERS, 0),
> + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
> + "failed to get adapter capabilities");
> +
> + if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
> + timeout_count = 10;
> + else
> + timeout_count = 9;
> +
> + TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, timeout_count * MAX_TIMERS, 0),
> "Timer triggered count doesn't match arm count");
> return TEST_SUCCESS;
> }
> @@ -649,12 +671,23 @@ test_timer_arm_burst(void)
> static inline int
> test_timer_arm_burst_periodic(void)
> {
> + uint32_t caps = 0;
> + uint32_t timeout_count = 0;
> +
> TEST_ASSERT_SUCCESS(_arm_timers_burst(1, MAX_TIMERS),
> "Failed to arm timers");
> /* With a resolution of 100ms and wait time of 1sec,
> * there will be 10 * MAX_TIMERS periodic timer triggers.
> */
> - TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, 10 * MAX_TIMERS, 0),
> + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
> + "failed to get adapter capabilities");
> +
> + if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
> + timeout_count = 10;
> + else
> + timeout_count = 9;
> +
> + TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, timeout_count * MAX_TIMERS, 0),
> "Timer triggered count doesn't match arm count");
>
> return TEST_SUCCESS;
> --
> 2.25.1
>
@@ -386,11 +386,22 @@ timdev_setup_msec(void)
static int
timdev_setup_msec_periodic(void)
{
+ uint32_t caps = 0;
+ uint64_t max_tmo_ns;
+
uint64_t flags = RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES |
RTE_EVENT_TIMER_ADAPTER_F_PERIODIC;
+ TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
+ "failed to get adapter capabilities");
+
+ if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
+ max_tmo_ns = 0;
+ else
+ max_tmo_ns = 180 * NSECPERSEC;
+
/* Periodic mode with 100 ms resolution */
- return _timdev_setup(0, NSECPERSEC / 10, flags);
+ return _timdev_setup(max_tmo_ns, NSECPERSEC / 10, flags);
}
static int
@@ -409,7 +420,7 @@ timdev_setup_sec_periodic(void)
RTE_EVENT_TIMER_ADAPTER_F_PERIODIC;
/* Periodic mode with 1 sec resolution */
- return _timdev_setup(0, NSECPERSEC, flags);
+ return _timdev_setup(180 * NSECPERSEC, NSECPERSEC, flags);
}
static int
@@ -561,12 +572,23 @@ test_timer_arm(void)
static inline int
test_timer_arm_periodic(void)
{
+ uint32_t caps = 0;
+ uint32_t timeout_count = 0;
+
TEST_ASSERT_SUCCESS(_arm_timers(1, MAX_TIMERS),
"Failed to arm timers");
/* With a resolution of 100ms and wait time of 1sec,
* there will be 10 * MAX_TIMERS periodic timer triggers.
*/
- TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, 10 * MAX_TIMERS, 0),
+ TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
+ "failed to get adapter capabilities");
+
+ if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
+ timeout_count = 10;
+ else
+ timeout_count = 9;
+
+ TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, timeout_count * MAX_TIMERS, 0),
"Timer triggered count doesn't match arm count");
return TEST_SUCCESS;
}
@@ -649,12 +671,23 @@ test_timer_arm_burst(void)
static inline int
test_timer_arm_burst_periodic(void)
{
+ uint32_t caps = 0;
+ uint32_t timeout_count = 0;
+
TEST_ASSERT_SUCCESS(_arm_timers_burst(1, MAX_TIMERS),
"Failed to arm timers");
/* With a resolution of 100ms and wait time of 1sec,
* there will be 10 * MAX_TIMERS periodic timer triggers.
*/
- TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, 10 * MAX_TIMERS, 0),
+ TEST_ASSERT_SUCCESS(rte_event_timer_adapter_caps_get(evdev, &caps),
+ "failed to get adapter capabilities");
+
+ if (caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)
+ timeout_count = 10;
+ else
+ timeout_count = 9;
+
+ TEST_ASSERT_SUCCESS(_wait_timer_triggers(1, timeout_count * MAX_TIMERS, 0),
"Timer triggered count doesn't match arm count");
return TEST_SUCCESS;