From patchwork Thu Jan 11 00:21:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Carrillo, Erik G" X-Patchwork-Id: 33542 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECD931B279; Thu, 11 Jan 2018 01:21:56 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id DE9911B1E0 for ; Thu, 11 Jan 2018 01:21:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 16:21:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,342,1511856000"; d="scan'208";a="192627475" Received: from txasoft-yocto.an.intel.com (HELO txasoft-yocto.an.intel.com.) ([10.123.72.111]) by orsmga005.jf.intel.com with ESMTP; 10 Jan 2018 16:21:44 -0800 From: Erik Gabriel Carrillo To: pbhagavatula@caviumnetworks.com Cc: dev@dpdk.org, jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com, hemant.agrawal@nxp.com Date: Wed, 10 Jan 2018 18:21:09 -0600 Message-Id: <1515630074-29020-19-git-send-email-erik.g.carrillo@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1515630074-29020-1-git-send-email-erik.g.carrillo@intel.com> References: <1512158458-22661-1-git-send-email-erik.g.carrillo@intel.com> <1515630074-29020-1-git-send-email-erik.g.carrillo@intel.com> Subject: [dpdk-dev] [PATCH v6 18/23] eventtimer: add non-blocking mode for event timer operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a mode to the event timer adapter that allows the event timer arm and cancel APIs to return immediately, rather than waiting for the service to update the state of each timer. Signed-off-by: Erik Gabriel Carrillo --- lib/librte_eventdev/rte_event_timer_adapter.c | 69 ++++++++++++++------------- lib/librte_eventdev/rte_event_timer_adapter.h | 6 +++ 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c index 0af68b2..624cc36 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.c +++ b/lib/librte_eventdev/rte_event_timer_adapter.c @@ -1022,28 +1022,31 @@ __sw_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, nb_evtims - n); } - for (i = 0; i < n; i++) { - /* Wait until state is updated */ - while (evtims[i]->state == RTE_EVENT_TIMER_NOT_ARMED || - evtims[i]->state == RTE_EVENT_TIMER_CANCELED) - ; - - /* Note any failures */ - if (evtims[i]->state != RTE_EVENT_TIMER_ARMED) { - fails[nb_fails++] = i; - rte_errno = EINVAL; - } + if (!(adapter->data->conf.flags & RTE_EVENT_TIMER_ADAPTER_F_NB_ARM)) { + for (i = 0; i < n; i++) { + /* Wait until state is updated */ + while (evtims[i]->state == RTE_EVENT_TIMER_NOT_ARMED || + evtims[i]->state == RTE_EVENT_TIMER_CANCELED) + ; + + /* Note any failures */ + if (evtims[i]->state != RTE_EVENT_TIMER_ARMED) { + fails[nb_fails++] = i; + rte_errno = EINVAL; + } - /* TODO: handle the case of consecutive arm requests; the - * second request can erroneously see success from the first - */ - } + /* TODO: handle the case of consecutive arm requests; + * the second request can erroneously see success from + * the first + */ + } - /* Move the failures to the end of the array */ - for (i = 0, mark = n - 1; i < nb_fails; i++, mark--) - swap(evtims, fails[i], mark); + /* Move the failures to the end of the array */ + for (i = 0, mark = n - 1; i < nb_fails; i++, mark--) + swap(evtims, fails[i], mark); - n = mark + 1; + n = mark + 1; + } return n; } @@ -1093,23 +1096,25 @@ sw_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, rte_mempool_put_bulk(sw_data->msg_pool, (void **)&msgs[n], nb_evtims - n); - for (i = 0; i < n; i++) { - /* Wait until state is updated */ - while (evtims[i]->state == RTE_EVENT_TIMER_ARMED) - ; + if (!(adapter->data->conf.flags & RTE_EVENT_TIMER_ADAPTER_F_NB_ARM)) { + for (i = 0; i < n; i++) { + /* Wait until state is updated */ + while (evtims[i]->state == RTE_EVENT_TIMER_ARMED) + ; - /* Note any failures */ - if (evtims[i]->state != RTE_EVENT_TIMER_CANCELED) { - fails[nb_fails++] = i; - rte_errno = EINVAL; + /* Note any failures */ + if (evtims[i]->state != RTE_EVENT_TIMER_CANCELED) { + fails[nb_fails++] = i; + rte_errno = EINVAL; + } } - } - /* Move the failures to the end of the array */ - for (i = 0, mark = n - 1; i < nb_fails; i++, mark--) - swap(evtims, fails[i], mark); + /* Move the failures to the end of the array */ + for (i = 0, mark = n - 1; i < nb_fails; i++, mark--) + swap(evtims, fails[i], mark); - n = mark + 1; + n = mark + 1; + } return n; } diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h index a4b16a7..2a69455 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.h +++ b/lib/librte_eventdev/rte_event_timer_adapter.h @@ -175,6 +175,12 @@ enum rte_event_timer_adapter_clk_src { * * @see struct rte_event_timer_adapter_conf::flags */ +#define RTE_EVENT_TIMER_ADAPTER_F_NB_ARM (1ULL << 2) +/**< ``rte_event_timer_arm_burst()`` API to be used in non-blocking/ + * asynchronous mode + * + * @see struct rte_event_timer_adapter_conf::flags + */ /** * @warning