Check if timer adapter is already started before starting it.
Update the unit test accordingly.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
TEST_ASSERT_SUCCESS(_timdev_setup(180 * NSECPERSEC,
NSECPERSEC / 10),
"Failed to start adapter");
- TEST_ASSERT_SUCCESS(rte_event_timer_adapter_start(timdev),
- "Failed to repeatedly start adapter");
+ TEST_ASSERT_EQUAL(rte_event_timer_adapter_start(timdev), -EALREADY,
+ "Timer adapter started without call to stop.");
return TEST_SUCCESS;
}
ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
FUNC_PTR_OR_ERR_RET(adapter->ops->start, -EINVAL);
+ if (adapter->data->started) {
+ EVTIM_LOG_ERR("event timer adapter %"PRIu8" already started",
+ adapter->data->id);
+ return -EALREADY;
+ }
+
ret = adapter->ops->start(adapter);
if (ret < 0)
return ret;
* - -EINVAL if adapter identifier invalid
* - -ENOENT if software adapter but no service core mapped
* - -ENOTSUP if software adapter and more than one service core mapped
+ * - -EALREADY if adapter has already been started
*
* @note
* The eventdev to which the event_timer_adapter is connected needs to