From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 03EB51B1DC for ; Thu, 11 Jan 2018 01:21:40 +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:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,342,1511856000"; d="scan'208";a="192627448" 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:39 -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:00 -0600 Message-Id: <1515630074-29020-10-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 09/23] eventtimer: add API to get service id 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: , X-List-Received-Date: Thu, 11 Jan 2018 00:21:41 -0000 When the event timer adapter uses a software implementation, timer management is performed on a service core using a service registered at the time of adapter creation. This commit adds a helper function to get the service id that can be used by an application to assign an lcore for the service to run on. Signed-off-by: Erik Gabriel Carrillo --- lib/librte_eventdev/rte_event_timer_adapter.c | 20 ++++++++++++++++++++ lib/librte_eventdev/rte_event_timer_adapter.h | 19 +++++++++++++++++++ lib/librte_eventdev/rte_event_timer_adapter_pmd.h | 4 ++++ lib/librte_eventdev/rte_eventdev_version.map | 1 + 4 files changed, 44 insertions(+) diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c index 27e6226..68748be 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.c +++ b/lib/librte_eventdev/rte_event_timer_adapter.c @@ -378,6 +378,23 @@ rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter) } int +rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter, + uint32_t *service_id) +{ + ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); + + if (service_id == NULL) + return -EINVAL; + + if (adapter->data->service_inited) { + *service_id = adapter->data->service_id; + return 0; + } + + return -ESRCH; +} + +int rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, struct rte_event_timer **evtims, uint16_t nb_evtims) @@ -521,6 +538,9 @@ sw_event_timer_adapter_init(struct rte_event_timer_adapter *adapter) if (ret < 0) return ret; + adapter->data->service_id = sw_data->service_id; + adapter->data->service_inited = 1; + return 0; } diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h index d1e4d18..84d3c39 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.h +++ b/lib/librte_eventdev/rte_event_timer_adapter.h @@ -402,6 +402,25 @@ struct rte_event_timer_adapter *rte_event_timer_adapter_lookup( int rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter); /** + * Retrieve the service ID of the event timer adapter. If the adapter doesn't + * use an rte_service function, this function returns -ESRCH. + * + * @param adapter + * A pointer to an event timer adapter. + * + * @param [out] service_id + * A pointer to a uint32_t, to be filled in with the service id. + * + * @return + * - 0: Success + * - <0: Error code on failure, if the event dev doesn't use a rte_service + * function, this function returns -ESRCH. + */ +int +rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter, + uint32_t *service_id); + +/** * @warning * @b EXPERIMENTAL: this structure may change without prior notice * diff --git a/lib/librte_eventdev/rte_event_timer_adapter_pmd.h b/lib/librte_eventdev/rte_event_timer_adapter_pmd.h index 485fad1..6c65c36 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter_pmd.h +++ b/lib/librte_eventdev/rte_event_timer_adapter_pmd.h @@ -125,6 +125,10 @@ struct rte_event_timer_adapter_data { /**< Adapter capabilities */ void *adapter_priv; /**< Timer adapter private data*/ + uint8_t service_inited; + /**< Service initialization state */ + uint32_t service_id; + /**< Service ID*/ RTE_STD_C11 uint8_t started : 1; diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index f56ca0f..a35a668 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -75,6 +75,7 @@ DPDK_18.02 { rte_event_timer_adapter_create_ext; rte_event_timer_adapter_free; rte_event_timer_adapter_get_info; + rte_event_timer_adapter_service_id_get; rte_event_timer_adapter_start; rte_event_timer_adapter_stop; rte_event_timer_arm_burst; -- 2.6.4