199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2010-2014 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_LCORE_H_ 699a2dd95SBruce Richardson #define _RTE_LCORE_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file 1099a2dd95SBruce Richardson * 1199a2dd95SBruce Richardson * API for lcore and socket manipulation 1299a2dd95SBruce Richardson */ 13770ebc06SDavid Marchand #include <stdio.h> 14770ebc06SDavid Marchand 151094dd94SDavid Marchand #include <rte_compat.h> 1699a2dd95SBruce Richardson #include <rte_config.h> 1799a2dd95SBruce Richardson #include <rte_per_lcore.h> 1899a2dd95SBruce Richardson #include <rte_eal.h> 1999a2dd95SBruce Richardson #include <rte_launch.h> 2099a2dd95SBruce Richardson #include <rte_thread.h> 2199a2dd95SBruce Richardson 2299a2dd95SBruce Richardson #ifdef __cplusplus 2399a2dd95SBruce Richardson extern "C" { 2499a2dd95SBruce Richardson #endif 2599a2dd95SBruce Richardson 2699a2dd95SBruce Richardson #define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */ 2799a2dd95SBruce Richardson 2899a2dd95SBruce Richardson RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ 2999a2dd95SBruce Richardson 3099a2dd95SBruce Richardson /** 3199a2dd95SBruce Richardson * The lcore role (used in RTE or not). 3299a2dd95SBruce Richardson */ 3399a2dd95SBruce Richardson enum rte_lcore_role_t { 3499a2dd95SBruce Richardson ROLE_RTE, 3599a2dd95SBruce Richardson ROLE_OFF, 3699a2dd95SBruce Richardson ROLE_SERVICE, 3799a2dd95SBruce Richardson ROLE_NON_EAL, 3899a2dd95SBruce Richardson }; 3999a2dd95SBruce Richardson 4099a2dd95SBruce Richardson /** 4199a2dd95SBruce Richardson * Get a lcore's role. 4299a2dd95SBruce Richardson * 4399a2dd95SBruce Richardson * @param lcore_id 4499a2dd95SBruce Richardson * The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. 4599a2dd95SBruce Richardson * @return 4699a2dd95SBruce Richardson * The role of the lcore. 4799a2dd95SBruce Richardson */ 4899a2dd95SBruce Richardson enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id); 4999a2dd95SBruce Richardson 5099a2dd95SBruce Richardson /** 5199a2dd95SBruce Richardson * Test if the core supplied has a specific role 5299a2dd95SBruce Richardson * 5399a2dd95SBruce Richardson * @param lcore_id 5499a2dd95SBruce Richardson * The identifier of the lcore, which MUST be between 0 and 5599a2dd95SBruce Richardson * RTE_MAX_LCORE-1. 5699a2dd95SBruce Richardson * @param role 5799a2dd95SBruce Richardson * The role to be checked against. 5899a2dd95SBruce Richardson * @return 5999a2dd95SBruce Richardson * Boolean value: positive if test is true; otherwise returns 0. 6099a2dd95SBruce Richardson */ 6199a2dd95SBruce Richardson int 6299a2dd95SBruce Richardson rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role); 6399a2dd95SBruce Richardson 6499a2dd95SBruce Richardson /** 6599a2dd95SBruce Richardson * Return the Application thread ID of the execution unit. 6699a2dd95SBruce Richardson * 6799a2dd95SBruce Richardson * Note: in most cases the lcore id returned here will also correspond 6899a2dd95SBruce Richardson * to the processor id of the CPU on which the thread is pinned, this 6999a2dd95SBruce Richardson * will not be the case if the user has explicitly changed the thread to 7099a2dd95SBruce Richardson * core affinities using --lcores EAL argument e.g. --lcores '(0-3)@10' 7199a2dd95SBruce Richardson * to run threads with lcore IDs 0, 1, 2 and 3 on physical core 10.. 7299a2dd95SBruce Richardson * 7399a2dd95SBruce Richardson * @return 7499a2dd95SBruce Richardson * Logical core ID (in EAL thread or registered non-EAL thread) or 7599a2dd95SBruce Richardson * LCORE_ID_ANY (in unregistered non-EAL thread) 7699a2dd95SBruce Richardson */ 7799a2dd95SBruce Richardson static inline unsigned 7899a2dd95SBruce Richardson rte_lcore_id(void) 7999a2dd95SBruce Richardson { 8099a2dd95SBruce Richardson return RTE_PER_LCORE(_lcore_id); 8199a2dd95SBruce Richardson } 8299a2dd95SBruce Richardson 8399a2dd95SBruce Richardson /** 8499a2dd95SBruce Richardson * Get the id of the main lcore 8599a2dd95SBruce Richardson * 8699a2dd95SBruce Richardson * @return 8799a2dd95SBruce Richardson * the id of the main lcore 8899a2dd95SBruce Richardson */ 8999a2dd95SBruce Richardson unsigned int rte_get_main_lcore(void); 9099a2dd95SBruce Richardson 9199a2dd95SBruce Richardson /** 9299a2dd95SBruce Richardson * Return the number of execution units (lcores) on the system. 9399a2dd95SBruce Richardson * 9499a2dd95SBruce Richardson * @return 9599a2dd95SBruce Richardson * the number of execution units (lcores) on the system. 9699a2dd95SBruce Richardson */ 9799a2dd95SBruce Richardson unsigned int rte_lcore_count(void); 9899a2dd95SBruce Richardson 9999a2dd95SBruce Richardson /** 10099a2dd95SBruce Richardson * Return the index of the lcore starting from zero. 10199a2dd95SBruce Richardson * 10299a2dd95SBruce Richardson * When option -c or -l is given, the index corresponds 10399a2dd95SBruce Richardson * to the order in the list. 10499a2dd95SBruce Richardson * For example: 10599a2dd95SBruce Richardson * -c 0x30, lcore 4 has index 0, and 5 has index 1. 10699a2dd95SBruce Richardson * -l 22,18 lcore 22 has index 0, and 18 has index 1. 10799a2dd95SBruce Richardson * 10899a2dd95SBruce Richardson * @param lcore_id 10999a2dd95SBruce Richardson * The targeted lcore, or -1 for the current one. 11099a2dd95SBruce Richardson * @return 11199a2dd95SBruce Richardson * The relative index, or -1 if not enabled. 11299a2dd95SBruce Richardson */ 11399a2dd95SBruce Richardson int rte_lcore_index(int lcore_id); 11499a2dd95SBruce Richardson 11599a2dd95SBruce Richardson /** 11699a2dd95SBruce Richardson * Return the ID of the physical socket of the logical core we are 11799a2dd95SBruce Richardson * running on. 11899a2dd95SBruce Richardson * @return 11999a2dd95SBruce Richardson * the ID of current lcoreid's physical socket 12099a2dd95SBruce Richardson */ 12199a2dd95SBruce Richardson unsigned int rte_socket_id(void); 12299a2dd95SBruce Richardson 12399a2dd95SBruce Richardson /** 12499a2dd95SBruce Richardson * Return number of physical sockets detected on the system. 12599a2dd95SBruce Richardson * 12699a2dd95SBruce Richardson * Note that number of nodes may not be correspondent to their physical id's: 12799a2dd95SBruce Richardson * for example, a system may report two socket id's, but the actual socket id's 12899a2dd95SBruce Richardson * may be 0 and 8. 12999a2dd95SBruce Richardson * 13099a2dd95SBruce Richardson * @return 13199a2dd95SBruce Richardson * the number of physical sockets as recognized by EAL 13299a2dd95SBruce Richardson */ 13399a2dd95SBruce Richardson unsigned int 13499a2dd95SBruce Richardson rte_socket_count(void); 13599a2dd95SBruce Richardson 13699a2dd95SBruce Richardson /** 13799a2dd95SBruce Richardson * Return socket id with a particular index. 13899a2dd95SBruce Richardson * 13999a2dd95SBruce Richardson * This will return socket id at a particular position in list of all detected 14099a2dd95SBruce Richardson * physical socket id's. For example, on a machine with sockets [0, 8], passing 14199a2dd95SBruce Richardson * 1 as a parameter will return 8. 14299a2dd95SBruce Richardson * 14399a2dd95SBruce Richardson * @param idx 14499a2dd95SBruce Richardson * index of physical socket id to return 14599a2dd95SBruce Richardson * 14699a2dd95SBruce Richardson * @return 14799a2dd95SBruce Richardson * - physical socket id as recognized by EAL 14899a2dd95SBruce Richardson * - -1 on error, with errno set to EINVAL 14999a2dd95SBruce Richardson */ 15099a2dd95SBruce Richardson int 15199a2dd95SBruce Richardson rte_socket_id_by_idx(unsigned int idx); 15299a2dd95SBruce Richardson 15399a2dd95SBruce Richardson /** 15499a2dd95SBruce Richardson * Get the ID of the physical socket of the specified lcore 15599a2dd95SBruce Richardson * 15699a2dd95SBruce Richardson * @param lcore_id 15799a2dd95SBruce Richardson * the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1. 15899a2dd95SBruce Richardson * @return 15999a2dd95SBruce Richardson * the ID of lcoreid's physical socket 16099a2dd95SBruce Richardson */ 16199a2dd95SBruce Richardson unsigned int 16299a2dd95SBruce Richardson rte_lcore_to_socket_id(unsigned int lcore_id); 16399a2dd95SBruce Richardson 16499a2dd95SBruce Richardson /** 16599a2dd95SBruce Richardson * Return the id of the lcore on a socket starting from zero. 16699a2dd95SBruce Richardson * 16799a2dd95SBruce Richardson * @param lcore_id 16899a2dd95SBruce Richardson * The targeted lcore, or -1 for the current one. 16999a2dd95SBruce Richardson * @return 17099a2dd95SBruce Richardson * The relative index, or -1 if not enabled. 17199a2dd95SBruce Richardson */ 172218f2f97SStephen Hemminger int rte_lcore_to_cpu_id(int lcore_id); 17399a2dd95SBruce Richardson 17499a2dd95SBruce Richardson #ifdef RTE_HAS_CPUSET 17599a2dd95SBruce Richardson 17699a2dd95SBruce Richardson /** 17799a2dd95SBruce Richardson * Return the cpuset for a given lcore. 178218f2f97SStephen Hemminger * 17999a2dd95SBruce Richardson * @param lcore_id 18099a2dd95SBruce Richardson * the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1. 18199a2dd95SBruce Richardson * @return 18299a2dd95SBruce Richardson * The cpuset of that lcore 18399a2dd95SBruce Richardson */ 184218f2f97SStephen Hemminger rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id); 18599a2dd95SBruce Richardson 18699a2dd95SBruce Richardson #endif /* RTE_HAS_CPUSET */ 18799a2dd95SBruce Richardson 18899a2dd95SBruce Richardson /** 18999a2dd95SBruce Richardson * Test if an lcore is enabled. 19099a2dd95SBruce Richardson * 19199a2dd95SBruce Richardson * @param lcore_id 19299a2dd95SBruce Richardson * The identifier of the lcore, which MUST be between 0 and 19399a2dd95SBruce Richardson * RTE_MAX_LCORE-1. 19499a2dd95SBruce Richardson * @return 19599a2dd95SBruce Richardson * True if the given lcore is enabled; false otherwise. 19699a2dd95SBruce Richardson */ 19799a2dd95SBruce Richardson int rte_lcore_is_enabled(unsigned int lcore_id); 19899a2dd95SBruce Richardson 19999a2dd95SBruce Richardson /** 20099a2dd95SBruce Richardson * Get the next enabled lcore ID. 20199a2dd95SBruce Richardson * 20299a2dd95SBruce Richardson * @param i 20399a2dd95SBruce Richardson * The current lcore (reference). 20499a2dd95SBruce Richardson * @param skip_main 20599a2dd95SBruce Richardson * If true, do not return the ID of the main lcore. 20699a2dd95SBruce Richardson * @param wrap 20799a2dd95SBruce Richardson * If true, go back to 0 when RTE_MAX_LCORE is reached; otherwise, 20899a2dd95SBruce Richardson * return RTE_MAX_LCORE. 20999a2dd95SBruce Richardson * @return 21099a2dd95SBruce Richardson * The next lcore_id or RTE_MAX_LCORE if not found. 21199a2dd95SBruce Richardson */ 21299a2dd95SBruce Richardson unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap); 21399a2dd95SBruce Richardson 21499a2dd95SBruce Richardson /** 21599a2dd95SBruce Richardson * Macro to browse all running lcores. 21699a2dd95SBruce Richardson */ 21799a2dd95SBruce Richardson #define RTE_LCORE_FOREACH(i) \ 21899a2dd95SBruce Richardson for (i = rte_get_next_lcore(-1, 0, 0); \ 21999a2dd95SBruce Richardson i < RTE_MAX_LCORE; \ 22099a2dd95SBruce Richardson i = rte_get_next_lcore(i, 0, 0)) 22199a2dd95SBruce Richardson 22299a2dd95SBruce Richardson /** 22399a2dd95SBruce Richardson * Macro to browse all running lcores except the main lcore. 22499a2dd95SBruce Richardson */ 22599a2dd95SBruce Richardson #define RTE_LCORE_FOREACH_WORKER(i) \ 22699a2dd95SBruce Richardson for (i = rte_get_next_lcore(-1, 1, 0); \ 22799a2dd95SBruce Richardson i < RTE_MAX_LCORE; \ 22899a2dd95SBruce Richardson i = rte_get_next_lcore(i, 1, 0)) 22999a2dd95SBruce Richardson 23099a2dd95SBruce Richardson /** 23199a2dd95SBruce Richardson * Callback prototype for initializing lcores. 23299a2dd95SBruce Richardson * 23399a2dd95SBruce Richardson * @param lcore_id 23499a2dd95SBruce Richardson * The lcore to consider. 23599a2dd95SBruce Richardson * @param arg 23699a2dd95SBruce Richardson * An opaque pointer passed at callback registration. 23799a2dd95SBruce Richardson * @return 23899a2dd95SBruce Richardson * - -1 when refusing this operation, 23999a2dd95SBruce Richardson * - 0 otherwise. 24099a2dd95SBruce Richardson */ 24199a2dd95SBruce Richardson typedef int (*rte_lcore_init_cb)(unsigned int lcore_id, void *arg); 24299a2dd95SBruce Richardson 24399a2dd95SBruce Richardson /** 24499a2dd95SBruce Richardson * Callback prototype for uninitializing lcores. 24599a2dd95SBruce Richardson * 24699a2dd95SBruce Richardson * @param lcore_id 24799a2dd95SBruce Richardson * The lcore to consider. 24899a2dd95SBruce Richardson * @param arg 24999a2dd95SBruce Richardson * An opaque pointer passed at callback registration. 25099a2dd95SBruce Richardson */ 25199a2dd95SBruce Richardson typedef void (*rte_lcore_uninit_cb)(unsigned int lcore_id, void *arg); 25299a2dd95SBruce Richardson 25399a2dd95SBruce Richardson /** 25499a2dd95SBruce Richardson * Register callbacks invoked when initializing and uninitializing a lcore. 25599a2dd95SBruce Richardson * 25699a2dd95SBruce Richardson * This function calls the init callback with all initialized lcores. 25799a2dd95SBruce Richardson * Any error reported by the init callback triggers a rollback calling the 25899a2dd95SBruce Richardson * uninit callback for each lcore. 25999a2dd95SBruce Richardson * If this step succeeds, the callbacks are put in the lcore callbacks list 26099a2dd95SBruce Richardson * that will get called for each lcore allocation/release. 26199a2dd95SBruce Richardson * 26299a2dd95SBruce Richardson * Note: callbacks execution is serialised under a write lock protecting the 26399a2dd95SBruce Richardson * lcores and callbacks list. 26499a2dd95SBruce Richardson * 26599a2dd95SBruce Richardson * @param name 26699a2dd95SBruce Richardson * A name serving as a small description for this callback. 26799a2dd95SBruce Richardson * @param init 26899a2dd95SBruce Richardson * The callback invoked when a lcore_id is initialized. 26999a2dd95SBruce Richardson * init can be NULL. 27099a2dd95SBruce Richardson * @param uninit 27199a2dd95SBruce Richardson * The callback invoked when a lcore_id is uninitialized. 27299a2dd95SBruce Richardson * uninit can be NULL. 27399a2dd95SBruce Richardson * @param arg 27499a2dd95SBruce Richardson * An optional argument that gets passed to the callback when it gets 27599a2dd95SBruce Richardson * invoked. 27699a2dd95SBruce Richardson * @return 27799a2dd95SBruce Richardson * On success, returns an opaque pointer for the registered object. 27899a2dd95SBruce Richardson * On failure (either memory allocation issue in the function itself or an 27999a2dd95SBruce Richardson * error is returned by the init callback itself), returns NULL. 28099a2dd95SBruce Richardson */ 28199a2dd95SBruce Richardson void * 28299a2dd95SBruce Richardson rte_lcore_callback_register(const char *name, rte_lcore_init_cb init, 28399a2dd95SBruce Richardson rte_lcore_uninit_cb uninit, void *arg); 28499a2dd95SBruce Richardson 28599a2dd95SBruce Richardson /** 28699a2dd95SBruce Richardson * Unregister callbacks previously registered with rte_lcore_callback_register. 28799a2dd95SBruce Richardson * 28899a2dd95SBruce Richardson * This function calls the uninit callback with all initialized lcores. 28999a2dd95SBruce Richardson * The callbacks are then removed from the lcore callbacks list. 29099a2dd95SBruce Richardson * 29199a2dd95SBruce Richardson * @param handle 29299a2dd95SBruce Richardson * The handle pointer returned by a former successful call to 29399a2dd95SBruce Richardson * rte_lcore_callback_register. 29499a2dd95SBruce Richardson */ 29599a2dd95SBruce Richardson void 29699a2dd95SBruce Richardson rte_lcore_callback_unregister(void *handle); 29799a2dd95SBruce Richardson 29899a2dd95SBruce Richardson /** 29999a2dd95SBruce Richardson * Callback prototype for iterating over lcores. 30099a2dd95SBruce Richardson * 30199a2dd95SBruce Richardson * @param lcore_id 30299a2dd95SBruce Richardson * The lcore to consider. 30399a2dd95SBruce Richardson * @param arg 30499a2dd95SBruce Richardson * An opaque pointer coming from the caller. 30599a2dd95SBruce Richardson * @return 30699a2dd95SBruce Richardson * - 0 lets the iteration continue. 30799a2dd95SBruce Richardson * - !0 makes the iteration stop. 30899a2dd95SBruce Richardson */ 30999a2dd95SBruce Richardson typedef int (*rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg); 31099a2dd95SBruce Richardson 31199a2dd95SBruce Richardson /** 31299a2dd95SBruce Richardson * Iterate on all active lcores (ROLE_RTE, ROLE_SERVICE and ROLE_NON_EAL). 31399a2dd95SBruce Richardson * No modification on the lcore states is allowed in the callback. 31499a2dd95SBruce Richardson * 31599a2dd95SBruce Richardson * Note: as opposed to init/uninit callbacks, iteration callbacks can be 31699a2dd95SBruce Richardson * invoked in parallel as they are run under a read lock protecting the lcores 31799a2dd95SBruce Richardson * and callbacks list. 31899a2dd95SBruce Richardson * 31999a2dd95SBruce Richardson * @param cb 32099a2dd95SBruce Richardson * The callback that gets passed each lcore. 32199a2dd95SBruce Richardson * @param arg 32299a2dd95SBruce Richardson * An opaque pointer passed to cb. 32399a2dd95SBruce Richardson * @return 32499a2dd95SBruce Richardson * Same return code as the callback last invocation (see rte_lcore_iterate_cb 32599a2dd95SBruce Richardson * description). 32699a2dd95SBruce Richardson */ 32799a2dd95SBruce Richardson int 32899a2dd95SBruce Richardson rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg); 32999a2dd95SBruce Richardson 33099a2dd95SBruce Richardson /** 331*9ab18049SRobin Jarry * lcore usage statistics. 332*9ab18049SRobin Jarry */ 333*9ab18049SRobin Jarry struct rte_lcore_usage { 334*9ab18049SRobin Jarry /** 335*9ab18049SRobin Jarry * The total amount of time that the application has been running on 336*9ab18049SRobin Jarry * this lcore, in TSC cycles. 337*9ab18049SRobin Jarry */ 338*9ab18049SRobin Jarry uint64_t total_cycles; 339*9ab18049SRobin Jarry /** 340*9ab18049SRobin Jarry * The amount of time the application was busy, handling some 341*9ab18049SRobin Jarry * workload on this lcore, in TSC cycles. 342*9ab18049SRobin Jarry */ 343*9ab18049SRobin Jarry uint64_t busy_cycles; 344*9ab18049SRobin Jarry }; 345*9ab18049SRobin Jarry 346*9ab18049SRobin Jarry /** 347*9ab18049SRobin Jarry * Callback to allow applications to report lcore usage. 348*9ab18049SRobin Jarry * 349*9ab18049SRobin Jarry * @param [in] lcore_id 350*9ab18049SRobin Jarry * The lcore to consider. 351*9ab18049SRobin Jarry * @param [out] usage 352*9ab18049SRobin Jarry * Counters representing this lcore usage. This can never be NULL. 353*9ab18049SRobin Jarry * @return 354*9ab18049SRobin Jarry * - 0 if fields in usage were updated successfully. The fields that the 355*9ab18049SRobin Jarry * application does not support must not be modified. 356*9ab18049SRobin Jarry * - a negative value if the information is not available or if any error 357*9ab18049SRobin Jarry * occurred. 358*9ab18049SRobin Jarry */ 359*9ab18049SRobin Jarry typedef int (*rte_lcore_usage_cb)(unsigned int lcore_id, struct rte_lcore_usage *usage); 360*9ab18049SRobin Jarry 361*9ab18049SRobin Jarry /** 362*9ab18049SRobin Jarry * Register a callback from an application to be called in rte_lcore_dump() and 363*9ab18049SRobin Jarry * the /eal/lcore/info telemetry endpoint handler. Applications are expected to 364*9ab18049SRobin Jarry * report lcore usage statistics via this callback. 365*9ab18049SRobin Jarry * 366*9ab18049SRobin Jarry * If a callback was already registered, it can be replaced with another callback 367*9ab18049SRobin Jarry * or unregistered with NULL. The previously registered callback may remain in 368*9ab18049SRobin Jarry * use for an undetermined period of time. 369*9ab18049SRobin Jarry * 370*9ab18049SRobin Jarry * @param cb 371*9ab18049SRobin Jarry * The callback function. 372*9ab18049SRobin Jarry */ 373*9ab18049SRobin Jarry void rte_lcore_register_usage_cb(rte_lcore_usage_cb cb); 374*9ab18049SRobin Jarry 375*9ab18049SRobin Jarry /** 37699a2dd95SBruce Richardson * List all lcores. 37799a2dd95SBruce Richardson * 37899a2dd95SBruce Richardson * @param f 37999a2dd95SBruce Richardson * The output stream where the dump should be sent. 38099a2dd95SBruce Richardson */ 38199a2dd95SBruce Richardson void 38299a2dd95SBruce Richardson rte_lcore_dump(FILE *f); 38399a2dd95SBruce Richardson 38499a2dd95SBruce Richardson /** 38599a2dd95SBruce Richardson * Register current non-EAL thread as a lcore. 38699a2dd95SBruce Richardson * 38799a2dd95SBruce Richardson * @note This API is not compatible with the multi-process feature: 38899a2dd95SBruce Richardson * - if a primary process registers a non-EAL thread, then no secondary process 38999a2dd95SBruce Richardson * will initialise. 39099a2dd95SBruce Richardson * - if a secondary process initialises successfully, trying to register a 39199a2dd95SBruce Richardson * non-EAL thread from either primary or secondary processes will always end 39299a2dd95SBruce Richardson * up with the thread getting LCORE_ID_ANY as lcore. 39399a2dd95SBruce Richardson * 39499a2dd95SBruce Richardson * @return 39599a2dd95SBruce Richardson * On success, return 0; otherwise return -1 with rte_errno set. 39699a2dd95SBruce Richardson */ 39799a2dd95SBruce Richardson int 39899a2dd95SBruce Richardson rte_thread_register(void); 39999a2dd95SBruce Richardson 40099a2dd95SBruce Richardson /** 40199a2dd95SBruce Richardson * Unregister current thread and release lcore if one was associated. 40299a2dd95SBruce Richardson */ 40399a2dd95SBruce Richardson void 40499a2dd95SBruce Richardson rte_thread_unregister(void); 40599a2dd95SBruce Richardson 40699a2dd95SBruce Richardson #ifdef __cplusplus 40799a2dd95SBruce Richardson } 40899a2dd95SBruce Richardson #endif 40999a2dd95SBruce Richardson 41099a2dd95SBruce Richardson 41199a2dd95SBruce Richardson #endif /* _RTE_LCORE_H_ */ 412