DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	"erik.g.carrillo@intel.com" <erik.g.carrillo@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
Subject: [dpdk-dev] [PATCH 1/2] eventdev: check timer adapter status before start
Date: Sat, 16 Mar 2019 20:27:36 +0000	[thread overview]
Message-ID: <20190316202709.11346-1-pbhagavatula@marvell.com> (raw)
Message-ID: <20190316202736.nVsIMbDe_aTTtw_jJ7DOJXFcdmaxlCP9aaRsp9D0I6o@z> (raw)

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Check if timer adapter is already started before starting it.
Update the unit test accordingly.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test/test_event_timer_adapter.c           | 4 ++--
 lib/librte_eventdev/rte_event_timer_adapter.c | 6 ++++++
 lib/librte_eventdev/rte_event_timer_adapter.h | 1 +
 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 a45b7d195..d4b78e093 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 79070d484..575da041b 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 db98dec46..0b10a7ab3 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
  */
 int __rte_experimental
 rte_event_timer_adapter_start(
-- 
2.21.0


             reply	other threads:[~2019-03-16 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-16 20:27 Pavan Nikhilesh Bhagavatula [this message]
2019-03-16 20:27 ` Pavan Nikhilesh Bhagavatula
2019-03-16 20:27 ` [dpdk-dev] [PATCH 2/2] test/event_timer: improve unit test compatability Pavan Nikhilesh Bhagavatula
2019-03-16 20:27   ` Pavan Nikhilesh Bhagavatula
2019-03-25 21:40   ` Carrillo, Erik G
2019-03-25 21:40     ` Carrillo, Erik G
2019-03-30 15:05     ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
2019-03-30 15:05       ` Jerin Jacob Kollanukkaran
2019-03-25 20:56 ` [dpdk-dev] [PATCH 1/2] eventdev: check timer adapter status before start Carrillo, Erik G
2019-03-25 20:56   ` Carrillo, Erik G

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190316202709.11346-1-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=jerinj@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).