summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Nikhilesh <pbhagavatula@marvell.com>2019-03-16 20:27:36 +0000
committerJerin Jacob <jerinj@marvell.com>2019-04-02 06:40:40 +0530
commitbb8ec887a55245b67671f507d177ce729ea51c6e (patch)
treeb07f0b5a8f465d6ce8b194a02d2bc1b9c27f75c2
parent08a710642d1d8bed831ecf2085e041213381fc68 (diff)
downloaddpdk-next-eventdev-bb8ec887a55245b67671f507d177ce729ea51c6e.zip
dpdk-next-eventdev-bb8ec887a55245b67671f507d177ce729ea51c6e.tar.gz
dpdk-next-eventdev-bb8ec887a55245b67671f507d177ce729ea51c6e.tar.xz
eventdev: check timer adapter status before start
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>
-rw-r--r--app/test/test_event_timer_adapter.c4
-rw-r--r--lib/librte_eventdev/rte_event_timer_adapter.c6
-rw-r--r--lib/librte_eventdev/rte_event_timer_adapter.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/app/test/test_event_timer_adapter.c b/app/test/test_event_timer_adapter.c
index a45b7d1..d4b78e0 100644
--- a/app/test/test_event_timer_adapter.c
+++ b/app/test/test_event_timer_adapter.c
@@ -1015,8 +1015,8 @@ adapter_start(void)
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;
}
diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c
index 79070d4..575da04 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.c
+++ b/lib/librte_eventdev/rte_event_timer_adapter.c
@@ -261,6 +261,12 @@ rte_event_timer_adapter_start(const struct rte_event_timer_adapter *adapter)
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;
diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h
index cc4518d..1b446c3 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.h
+++ b/lib/librte_eventdev/rte_event_timer_adapter.h
@@ -339,6 +339,7 @@ rte_event_timer_adapter_get_info(
* - -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