77 em_shm->dispatch_enter_cb_tbl =
78 &
em_shm->dispatch_enter_cb_storage.hook_tbl_storage[0];
80 &
em_shm->dispatch_exit_cb_storage.hook_tbl_storage[0];
82 &
em_shm->alloc_hook_storage.hook_tbl_storage[0];
84 &
em_shm->free_hook_storage.hook_tbl_storage[0];
86 &
em_shm->send_hook_storage.hook_tbl_storage[0];
95 em_shm->dispatch_enter_cb_storage.idx = 0;
96 em_shm->dispatch_exit_cb_storage.idx = 0;
97 em_shm->alloc_hook_storage.idx = 0;
98 em_shm->free_hook_storage.idx = 0;
99 em_shm->send_hook_storage.idx = 0;
105 odp_ticketlock_init(&
em_shm->dispatch_enter_cb_storage.lock);
106 odp_ticketlock_init(&
em_shm->dispatch_exit_cb_storage.lock);
107 odp_ticketlock_init(&
em_shm->alloc_hook_storage.lock);
108 odp_ticketlock_init(&
em_shm->free_hook_storage.lock);
109 odp_ticketlock_init(&
em_shm->send_hook_storage.lock);
118 stat = hook_register(ALLOC_HOOK, hook_fn);
119 if (unlikely(stat !=
EM_OK))
124 stat = hook_register(FREE_HOOK, hook_fn);
125 if (unlikely(stat !=
EM_OK))
130 stat = hook_register(SEND_HOOK, hook_fn);
131 if (unlikely(stat !=
EM_OK))
139 stat = hook_register(TO_IDLE_HOOK, hook_fn);
140 if (unlikely(stat !=
EM_OK))
145 stat = hook_register(TO_ACTIVE_HOOK, hook_fn);
146 if (unlikely(stat !=
EM_OK))
151 stat = hook_register(WHILE_IDLE_HOOK, hook_fn);
152 if (unlikely(stat !=
EM_OK))
172 active_tbl_ptr = get_hook_tbl(hook_type, &hook_storage);
173 if (unlikely(active_tbl_ptr == NULL))
176 odp_ticketlock_lock(&hook_storage->
lock);
180 idx = hook_storage->
idx;
182 if (next_idx >= API_HOOKS_MAX_TBL_SIZE)
191 memcpy(next_tbl->tbl, hook_tbl->tbl,
sizeof(next_tbl->tbl));
194 if (next_tbl->tbl[i].void_hook == NULL)
198 odp_ticketlock_unlock(&hook_storage->
lock);
202 next_tbl->tbl[i] = hook_fn;
205 *active_tbl_ptr = next_tbl;
207 hook_storage->
idx = next_idx;
209 odp_ticketlock_unlock(&hook_storage->
lock);
226 active_tbl_ptr = get_hook_tbl(hook_type, &hook_storage);
227 if (unlikely(active_tbl_ptr == NULL))
230 odp_ticketlock_lock(&hook_storage->
lock);
234 idx = hook_storage->
idx;
236 if (next_idx >= API_HOOKS_MAX_TBL_SIZE)
245 memcpy(next_tbl->tbl, hook_tbl->tbl,
sizeof(next_tbl->tbl));
248 if (next_tbl->tbl[i].void_hook == hook_fn.void_hook)
251 odp_ticketlock_unlock(&hook_storage->
lock);
259 next_tbl->tbl[i].void_hook = NULL;
260 ret = pack_hook_tbl(next_tbl, i);
261 if (unlikely(ret != 0)) {
262 odp_ticketlock_unlock(&hook_storage->
lock);
267 *active_tbl_ptr = next_tbl;
269 hook_storage->
idx = next_idx;
271 odp_ticketlock_unlock(&hook_storage->
lock);