X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_timer%2Frte_timer.h;h=22a27aa08da525d860b3e16d7e7d6d75d7c08d5e;hb=47dcca067f4ab978df3414741be8fa00ddbac4f0;hp=1b0d5f6a5a4fb311cc1723be5d401ccf21d11e5b;hpb=18218713bf4248c4c6b97a12231e7d59b8a86865;p=dpdk.git diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h index 1b0d5f6a5a..22a27aa08d 100644 --- a/lib/librte_timer/rte_timer.h +++ b/lib/librte_timer/rte_timer.h @@ -133,9 +133,6 @@ struct rte_timer #endif /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Allocate a timer data instance in shared memory to track a set of pending * timer lists. * @@ -147,13 +144,9 @@ struct rte_timer * - 0: Success * - -ENOSPC: maximum number of timer data instances already allocated */ -__rte_experimental int rte_timer_data_alloc(uint32_t *id_ptr); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Deallocate a timer data instance. * * @param id @@ -163,7 +156,6 @@ int rte_timer_data_alloc(uint32_t *id_ptr); * - 0: Success * - -EINVAL: invalid timer data instance identifier */ -__rte_experimental int rte_timer_data_dealloc(uint32_t id); /** @@ -172,24 +164,19 @@ int rte_timer_data_dealloc(uint32_t id); * Initializes internal variables (list, locks and so on) for the RTE * timer library. * + * @note + * This function must be called in every process before using the library. + * * @return * - 0: Success - * - -EEXIST: Returned in secondary process when primary process has not - * yet initialized the timer subsystem * - -ENOMEM: Unable to allocate memory needed to initialize timer * subsystem */ int rte_timer_subsystem_init(void); -int rte_timer_subsystem_init_v1905(void); -void rte_timer_subsystem_init_v20(void); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Free timer subsystem resources. */ -__rte_experimental void rte_timer_subsystem_finalize(void); /** @@ -249,13 +236,6 @@ void rte_timer_init(struct rte_timer *tim); int rte_timer_reset(struct rte_timer *tim, uint64_t ticks, enum rte_timer_type type, unsigned tim_lcore, rte_timer_cb_t fct, void *arg); -int rte_timer_reset_v1905(struct rte_timer *tim, uint64_t ticks, - enum rte_timer_type type, unsigned int tim_lcore, - rte_timer_cb_t fct, void *arg); -int rte_timer_reset_v20(struct rte_timer *tim, uint64_t ticks, - enum rte_timer_type type, unsigned int tim_lcore, - rte_timer_cb_t fct, void *arg); - /** * Loop until rte_timer_reset() succeeds. @@ -282,6 +262,12 @@ int rte_timer_reset_v20(struct rte_timer *tim, uint64_t ticks, * The callback function of the timer. * @param arg * The user argument of the callback function. + * + * @note + * This API should not be called inside a timer's callback function to + * reset another timer; doing so could hang in certain scenarios. Instead, + * the rte_timer_reset() API can be called directly and its return code + * can be checked for success or failure. */ void rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, @@ -312,8 +298,6 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, * - (-1): The timer is in the RUNNING or CONFIG state. */ int rte_timer_stop(struct rte_timer *tim); -int rte_timer_stop_v1905(struct rte_timer *tim); -int rte_timer_stop_v20(struct rte_timer *tim); /** * Loop until rte_timer_stop() succeeds. @@ -323,6 +307,12 @@ int rte_timer_stop_v20(struct rte_timer *tim); * * @param tim * The timer handle. + * + * @note + * This API should not be called inside a timer's callback function to + * stop another timer; doing so could hang in certain scenarios. Instead, the + * rte_timer_stop() API can be called directly and its return code can + * be checked for success or failure. */ void rte_timer_stop_sync(struct rte_timer *tim); @@ -341,6 +331,22 @@ void rte_timer_stop_sync(struct rte_timer *tim); */ int rte_timer_pending(struct rte_timer *tim); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Time until the next timer on the current lcore + * This function gives the ticks until the next timer will be active. + * + * @return + * - -EINVAL: invalid timer data instance identifier + * - -ENOENT: no timer pending + * - 0: a timer is pending and will run at next rte_timer_manage() + * - >0: ticks until the next timer is ready + */ +__rte_experimental +int64_t rte_timer_next_ticks(void); + /** * Manage the timer list and execute callback functions. * @@ -357,8 +363,6 @@ int rte_timer_pending(struct rte_timer *tim); * - -EINVAL: timer subsystem not yet initialized */ int rte_timer_manage(void); -int rte_timer_manage_v1905(void); -void rte_timer_manage_v20(void); /** * Dump statistics about timers. @@ -370,13 +374,8 @@ void rte_timer_manage_v20(void); * - -EINVAL: timer subsystem not yet initialized */ int rte_timer_dump_stats(FILE *f); -int rte_timer_dump_stats_v1905(FILE *f); -void rte_timer_dump_stats_v20(FILE *f); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * This function is the same as rte_timer_reset(), except that it allows a * caller to specify the rte_timer_data instance containing the list to which * the timer should be added. @@ -411,16 +410,12 @@ void rte_timer_dump_stats_v20(FILE *f); * - (-1): Timer is in the RUNNING or CONFIG state. * - -EINVAL: invalid timer_data_id */ -__rte_experimental int rte_timer_alt_reset(uint32_t timer_data_id, struct rte_timer *tim, uint64_t ticks, enum rte_timer_type type, unsigned int tim_lcore, rte_timer_cb_t fct, void *arg); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * This function is the same as rte_timer_stop(), except that it allows a * caller to specify the rte_timer_data instance containing the list from which * this timer should be removed. @@ -437,7 +432,6 @@ rte_timer_alt_reset(uint32_t timer_data_id, struct rte_timer *tim, * - (-1): The timer is in the RUNNING or CONFIG state. * - -EINVAL: invalid timer_data_id */ -__rte_experimental int rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim); @@ -447,9 +441,6 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim); typedef void (*rte_timer_alt_manage_cb_t)(struct rte_timer *tim); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Manage a set of timer lists and execute the specified callback function for * all expired timers. This function is similar to rte_timer_manage(), except * that it allows a caller to specify the timer_data instance that should @@ -474,7 +465,6 @@ typedef void (*rte_timer_alt_manage_cb_t)(struct rte_timer *tim); * - 0: success * - -EINVAL: invalid timer_data_id */ -__rte_experimental int rte_timer_alt_manage(uint32_t timer_data_id, unsigned int *poll_lcores, int n_poll_lcores, rte_timer_alt_manage_cb_t f); @@ -485,9 +475,6 @@ rte_timer_alt_manage(uint32_t timer_data_id, unsigned int *poll_lcores, typedef void (*rte_timer_stop_all_cb_t)(struct rte_timer *tim, void *arg); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Walk the pending timer lists for the specified lcore IDs, and for each timer * that is encountered, stop it and call the specified callback function to * process it further. @@ -507,15 +494,11 @@ typedef void (*rte_timer_stop_all_cb_t)(struct rte_timer *tim, void *arg); * - 0: success * - EINVAL: invalid timer_data_id */ -__rte_experimental int rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, int nb_walk_lcores, rte_timer_stop_all_cb_t f, void *f_arg); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * This function is the same as rte_timer_dump_stats(), except that it allows * the caller to specify the rte_timer_data instance that should be used. * @@ -530,7 +513,6 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, * - 0: success * - -EINVAL: invalid timer_data_id */ -__rte_experimental int rte_timer_alt_dump_stats(uint32_t timer_data_id, FILE *f);