1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
8 /* callback function pointer when specific slave leaves */
9 typedef void (slave_exit_notify)(unsigned slaveid, int stat);
15 ST_ZOMBIE, /* Not implemented yet */
19 * Initialize the fork lib.
22 * - 0 : fork lib initialized successfully
23 * - -1 : fork lib initialized failed
28 * Check that every SLAVE lcores are in WAIT state, then call
29 * flib_remote_launch() for all of them. If call_master is true
30 * (set to CALL_MASTER), also call the function on the master lcore.
33 * function pointer need to run
35 * argument for f to carry
37 * - SKIP_MASTER : only launch function on slave lcores
38 * - CALL_MASTER : launch function on master and slave lcores
40 * - 0 : function execute successfully
41 * - -1 : function execute failed
43 int flib_mp_remote_launch(lcore_function_t *f,
44 void *arg, enum rte_rmt_call_master_t call_master);
47 * Send a message to a slave lcore identified by slave_id to call a
48 * function f with argument arg.
51 * function pointer need to run
53 * argument for f to carry
55 * slave lcore id to run on
57 * - 0 : function execute successfully
58 * - -1 : function execute failed
60 int flib_remote_launch(lcore_function_t *f,
61 void *arg, unsigned slave_id);
64 * Query the running stat for specific slave, wont' work in with master id
67 * lcore id which should not be master id
69 * - ST_FREEZE : lcore is not in enabled core mask
70 * - ST_IDLE : lcore is idle
71 * - ST_RUN : lcore is running something
74 flib_query_slave_status(unsigned slave_id);
77 * Register a callback function to be notified in case specific slave exit.
80 * lcore id which should not be master id
82 * callback pointer to register
84 * - 0 : function execute successfully
85 * - -EFAULT : argument error
86 * - -ENOENT : slave_id not correct
88 int flib_register_slave_exit_notify(unsigned slave_id,
89 slave_exit_notify *cb);
92 * Assign a lcore ID to non-slave thread. Non-slave thread refers to thread that
93 * not created by function rte_eal_remote_launch or rte_eal_mp_remote_launch.
94 * These threads can either bind lcore or float among different lcores.
95 * This lcore ID will be unique in multi-thread or multi-process DPDK running
96 * environment, then it can benefit from using the cache mechanism provided in
98 * After calling successfully, use rte_lcore_id() to get the assigned lcore ID, but
99 * other lcore funtions can't guarantee to work correctly.
102 * - -1 : can't assign a lcore id with 3 possibilities.
103 * - it's not non-slave thread.
104 * - it had assign a lcore id previously
105 * - the lcore id is running out.
106 * - > 0 : the assigned lcore id.
108 int flib_assign_lcore_id(void);
111 * Free the lcore_id that assigned in flib_assign_lcore_id().
112 * call it in case non-slave thread is leaving or left.
115 * The identifier of the lcore, which MUST be between 1 and
118 void flib_free_lcore_id(unsigned lcore_id);
120 #endif /* __FLIB_H */