X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_timer%2Frte_timer.h;h=c6b3d450df1f9b74adab5723028b8e5f81cf094a;hb=cd9fa688ee1c1a6d29ea36420a6c39a98e6ae59c;hp=6a9c4990936cf67bd3b1bc87b6a1785df1ed2501;hpb=c0749f7096c7e39ce9e8969b0ab0955d82500511;p=dpdk.git diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h index 6a9c499093..c6b3d450df 100644 --- a/lib/librte_timer/rte_timer.h +++ b/lib/librte_timer/rte_timer.h @@ -147,7 +147,8 @@ struct rte_timer * - 0: Success * - -ENOSPC: maximum number of timer data instances already allocated */ -int __rte_experimental rte_timer_data_alloc(uint32_t *id_ptr); +__rte_experimental +int rte_timer_data_alloc(uint32_t *id_ptr); /** * @warning @@ -162,30 +163,23 @@ int __rte_experimental rte_timer_data_alloc(uint32_t *id_ptr); * - 0: Success * - -EINVAL: invalid timer data instance identifier */ -int __rte_experimental rte_timer_data_dealloc(uint32_t id); +__rte_experimental +int rte_timer_data_dealloc(uint32_t id); /** * Initialize the timer library. * * Initializes internal variables (list, locks and so on) for the RTE * timer library. - */ -void rte_timer_subsystem_init_v20(void); - -/** - * Initialize the timer library. * - * 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_v1905(void); int rte_timer_subsystem_init(void); /** @@ -194,7 +188,8 @@ int rte_timer_subsystem_init(void); * * Free timer subsystem resources. */ -void __rte_experimental rte_timer_subsystem_finalize(void); +__rte_experimental +void rte_timer_subsystem_finalize(void); /** * Initialize a timer handle. @@ -250,17 +245,10 @@ void rte_timer_init(struct rte_timer *tim); * - 0: Success; the timer is scheduled. * - (-1): Timer is in the RUNNING or CONFIG state. */ -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); -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(struct rte_timer *tim, uint64_t ticks, enum rte_timer_type type, unsigned tim_lcore, rte_timer_cb_t fct, void *arg); - /** * Loop until rte_timer_reset() succeeds. * @@ -315,8 +303,6 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, * - 0: Success; the timer is stopped. * - (-1): The timer is in the RUNNING or CONFIG state. */ -int rte_timer_stop_v20(struct rte_timer *tim); -int rte_timer_stop_v1905(struct rte_timer *tim); int rte_timer_stop(struct rte_timer *tim); /** @@ -346,17 +332,20 @@ void rte_timer_stop_sync(struct rte_timer *tim); int rte_timer_pending(struct rte_timer *tim); /** - * Manage the timer list and execute callback functions. + * @warning + * @b EXPERIMENTAL: this API may change without prior notice * - * This function must be called periodically from EAL lcores - * main_loop(). It browses the list of pending timers and runs all - * timers that are expired. + * Time until the next timer on the current lcore + * This function gives the ticks until the next timer will be active. * - * The precision of the timer depends on the call frequency of this - * function. However, the more often the function is called, the more - * CPU resources it will use. + * @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 */ -void rte_timer_manage_v20(void); +__rte_experimental +int64_t rte_timer_next_ticks(void); /** * Manage the timer list and execute callback functions. @@ -373,17 +362,8 @@ void rte_timer_manage_v20(void); * - 0: Success * - -EINVAL: timer subsystem not yet initialized */ -int rte_timer_manage_v1905(void); int rte_timer_manage(void); -/** - * Dump statistics about timers. - * - * @param f - * A pointer to a file for output - */ -void rte_timer_dump_stats_v20(FILE *f); - /** * Dump statistics about timers. * @@ -393,7 +373,6 @@ void rte_timer_dump_stats_v20(FILE *f); * - 0: Success * - -EINVAL: timer subsystem not yet initialized */ -int rte_timer_dump_stats_v1905(FILE *f); int rte_timer_dump_stats(FILE *f); /** @@ -434,7 +413,8 @@ int rte_timer_dump_stats(FILE *f); * - (-1): Timer is in the RUNNING or CONFIG state. * - -EINVAL: invalid timer_data_id */ -int __rte_experimental +__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); @@ -459,7 +439,8 @@ 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 */ -int __rte_experimental +__rte_experimental +int rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim); /** @@ -495,10 +476,44 @@ typedef void (*rte_timer_alt_manage_cb_t)(struct rte_timer *tim); * - 0: success * - -EINVAL: invalid timer_data_id */ -int __rte_experimental +__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); +/** + * Callback function type for rte_timer_stop_all(). + */ +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. + * + * @param timer_data_id + * An identifier indicating which instance of timer data should be used for + * this operation. + * @param walk_lcores + * An array of lcore ids identifying the timer lists that should be processed. + * @param nb_walk_lcores + * The size of the walk_lcores array. + * @param f + * The callback function which should be called for each timers. Can be NULL. + * @param f_arg + * An arbitrary argument that will be passed to f, if it is called. + * @return + * - 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 @@ -517,7 +532,8 @@ rte_timer_alt_manage(uint32_t timer_data_id, unsigned int *poll_lcores, * - 0: success * - -EINVAL: invalid timer_data_id */ -int __rte_experimental +__rte_experimental +int rte_timer_alt_dump_stats(uint32_t timer_data_id, FILE *f); #ifdef __cplusplus