From ca33590b6af032bff57d9cc70455660466a654b2 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 19 Feb 2018 11:16:57 +0000 Subject: New upstream version 18.02 Change-Id: I89ed24cb2a49b78fe5be6970b99dd46c1499fcc3 Signed-off-by: Luca Boccassi --- lib/librte_eal/common/include/rte_service.h | 118 ++++++++++++++++------------ 1 file changed, 66 insertions(+), 52 deletions(-) (limited to 'lib/librte_eal/common/include/rte_service.h') diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 92724406..211eb376 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/include/rte_service.h @@ -1,33 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2017 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #ifndef _RTE_SERVICE_H_ @@ -59,6 +31,7 @@ extern "C" { #include #include +#include #include #define RTE_SERVICE_NAME_MAX 32 @@ -84,7 +57,7 @@ extern "C" { * * @return The number of services registered. */ -uint32_t rte_service_get_count(void); +uint32_t __rte_experimental rte_service_get_count(void); /** * @warning @@ -111,7 +84,8 @@ uint32_t rte_service_get_count(void); * @retval -EINVAL Null *service_id* pointer provided * @retval -ENODEV No such service registered */ -int32_t rte_service_get_by_name(const char *name, uint32_t *service_id); +int32_t __rte_experimental rte_service_get_by_name(const char *name, + uint32_t *service_id); /** * @warning @@ -122,7 +96,7 @@ int32_t rte_service_get_by_name(const char *name, uint32_t *service_id); * @return A pointer to the name of the service. The returned pointer remains * in ownership of the service, and the application must not free it. */ -const char *rte_service_get_name(uint32_t id); +const char __rte_experimental *rte_service_get_name(uint32_t id); /** * @warning @@ -135,7 +109,8 @@ const char *rte_service_get_name(uint32_t id); * @retval 1 Capability supported by this service instance * @retval 0 Capability not supported by this service instance */ -int32_t rte_service_probe_capability(uint32_t id, uint32_t capability); +int32_t __rte_experimental rte_service_probe_capability(uint32_t id, + uint32_t capability); /** * @warning @@ -159,8 +134,8 @@ int32_t rte_service_probe_capability(uint32_t id, uint32_t capability); * @retval 0 lcore map updated successfully * @retval -EINVAL An invalid service or lcore was provided. */ -int32_t rte_service_map_lcore_set(uint32_t service_id, uint32_t lcore, - uint32_t enable); +int32_t __rte_experimental rte_service_map_lcore_set(uint32_t service_id, + uint32_t lcore, uint32_t enable); /** * @warning @@ -175,7 +150,8 @@ int32_t rte_service_map_lcore_set(uint32_t service_id, uint32_t lcore, * @retval 0 lcore is not mapped to service * @retval -EINVAL An invalid service or lcore was provided. */ -int32_t rte_service_map_lcore_get(uint32_t service_id, uint32_t lcore); +int32_t __rte_experimental rte_service_map_lcore_get(uint32_t service_id, + uint32_t lcore); /** * @warning @@ -192,7 +168,7 @@ int32_t rte_service_map_lcore_get(uint32_t service_id, uint32_t lcore); * @retval 0 The service was successfully started * @retval -EINVAL Invalid service id */ -int32_t rte_service_runstate_set(uint32_t id, uint32_t runstate); +int32_t __rte_experimental rte_service_runstate_set(uint32_t id, uint32_t runstate); /** * @warning @@ -210,7 +186,7 @@ int32_t rte_service_runstate_set(uint32_t id, uint32_t runstate); * @retval 0 Service is stopped * @retval -EINVAL Invalid service id */ -int32_t rte_service_runstate_get(uint32_t id); +int32_t __rte_experimental rte_service_runstate_get(uint32_t id); /** * @warning @@ -226,7 +202,8 @@ int32_t rte_service_runstate_get(uint32_t id); * @retval 0 Success * @retval -EINVAL Invalid service ID */ -int32_t rte_service_set_runstate_mapped_check(uint32_t id, int32_t enable); +int32_t __rte_experimental rte_service_set_runstate_mapped_check(uint32_t id, + int32_t enable); /** * @warning @@ -264,7 +241,7 @@ int32_t rte_service_set_runstate_mapped_check(uint32_t id, int32_t enable); * @retval -ENOEXEC Service is not in a run-able state * @retval -EINVAL Invalid service id */ -int32_t rte_service_run_iter_on_app_lcore(uint32_t id, +int32_t __rte_experimental rte_service_run_iter_on_app_lcore(uint32_t id, uint32_t serialize_multithread_unsafe); /** @@ -274,13 +251,15 @@ int32_t rte_service_run_iter_on_app_lcore(uint32_t id, * Start a service core. * * Starting a core makes the core begin polling. Any services assigned to it - * will be run as fast as possible. + * will be run as fast as possible. The application must ensure that the lcore + * is in a launchable state: e.g. call *rte_eal_lcore_wait* on the lcore_id + * before calling this function. * * @retval 0 Success * @retval -EINVAL Failed to start core. The *lcore_id* passed in is not * currently assigned to be a service core. */ -int32_t rte_service_lcore_start(uint32_t lcore_id); +int32_t __rte_experimental rte_service_lcore_start(uint32_t lcore_id); /** * @warning @@ -299,7 +278,7 @@ int32_t rte_service_lcore_start(uint32_t lcore_id); * The application must stop the service first, and then stop the * lcore. */ -int32_t rte_service_lcore_stop(uint32_t lcore_id); +int32_t __rte_experimental rte_service_lcore_stop(uint32_t lcore_id); /** * @warning @@ -315,7 +294,7 @@ int32_t rte_service_lcore_stop(uint32_t lcore_id); * @retval -EALREADY lcore is already added to the service core list * @retval -EINVAL Invalid lcore provided */ -int32_t rte_service_lcore_add(uint32_t lcore); +int32_t __rte_experimental rte_service_lcore_add(uint32_t lcore); /** * @warning @@ -329,7 +308,7 @@ int32_t rte_service_lcore_add(uint32_t lcore); * @retval -EBUSY Lcore is not stopped, stop service core before removing. * @retval -EINVAL failed to add lcore to service core mask. */ -int32_t rte_service_lcore_del(uint32_t lcore); +int32_t __rte_experimental rte_service_lcore_del(uint32_t lcore); /** * @warning @@ -346,7 +325,7 @@ int32_t rte_service_lcore_del(uint32_t lcore); * * @return The number of service cores currently configured. */ -int32_t rte_service_lcore_count(void); +int32_t __rte_experimental rte_service_lcore_count(void); /** * @warning @@ -358,7 +337,7 @@ int32_t rte_service_lcore_count(void); * * @retval 0 Success */ -int32_t rte_service_lcore_reset_all(void); +int32_t __rte_experimental rte_service_lcore_reset_all(void); /** * @warning @@ -372,7 +351,8 @@ int32_t rte_service_lcore_reset_all(void); * @retval 0 Success * @retval -EINVAL Invalid service pointer passed */ -int32_t rte_service_set_stats_enable(uint32_t id, int32_t enable); +int32_t __rte_experimental rte_service_set_stats_enable(uint32_t id, + int32_t enable); /** * @warning @@ -393,7 +373,7 @@ int32_t rte_service_set_stats_enable(uint32_t id, int32_t enable); * service core list. No items have been populated, call this function * with a size of at least *rte_service_core_count* items. */ -int32_t rte_service_lcore_list(uint32_t array[], uint32_t n); +int32_t __rte_experimental rte_service_lcore_list(uint32_t array[], uint32_t n); /** * @warning @@ -406,7 +386,7 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n); * @retval -EINVAL Invalid lcore provided * @retval -ENOTSUP The provided lcore is not a service core. */ -int32_t rte_service_lcore_count_services(uint32_t lcore); +int32_t __rte_experimental rte_service_lcore_count_services(uint32_t lcore); /** * @warning @@ -418,7 +398,41 @@ int32_t rte_service_lcore_count_services(uint32_t lcore); * @retval 0 Statistics have been successfully dumped * @retval -EINVAL Invalid service id provided */ -int32_t rte_service_dump(FILE *f, uint32_t id); +int32_t __rte_experimental rte_service_dump(FILE *f, uint32_t id); + +/** + * Returns the number of cycles that this service has consumed + */ +#define RTE_SERVICE_ATTR_CYCLES 0 + +/** + * Returns the count of invocations of this service function + */ +#define RTE_SERVICE_ATTR_CALL_COUNT 1 + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Get an attribute from a service. + * + * @retval 0 Success, the attribute value has been written to *attr_value*. + * -EINVAL Invalid id, attr_id or attr_value was NULL. + */ +int32_t __rte_experimental rte_service_attr_get(uint32_t id, uint32_t attr_id, + uint32_t *attr_value); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Reset all attribute values of a service. + * + * @param id The service to reset all statistics of + * @retval 0 Successfully reset attributes + * -EINVAL Invalid service id provided + */ +int32_t __rte_experimental rte_service_attr_reset_all(uint32_t id); #ifdef __cplusplus } -- cgit 1.2.3-korg