API Reference Manual 1.51.0
Loading...
Searching...
No Matches
work.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2025 Nokia
3 */
4
7#ifndef WORK_H_
8#define WORK_H_
9
10#include <inttypes.h>
11#include <stdint.h>
12#include <stdio.h>
13
14#include <libconfig.h>
15#include <odp_api.h>
16
17#include "helpers.h"
18
19typedef void *work_t;
20
21typedef struct {
22 char *queue;
23 char *type;
24 config_setting_t *param;
25} work_param_t;
26
27typedef struct {
28 uint64_t data1;
29 uint64_t data2;
30 uint64_t data3;
31 uint64_t data4;
32} work_stats_t;
33
34typedef int (*work_fn_t)(uintptr_t data, odp_event_t ev[], int num, work_stats_t *stats);
35
36typedef struct {
37 work_fn_t fn;
38 uintptr_t data;
39} work_init_t;
40
41typedef void (*work_init_fn_t)(const work_param_t *param, work_init_t *init);
42typedef void (*work_print_fn_t)(const char *queue, const work_stats_t *stats);
43typedef void (*work_destroy_fn_t)(uintptr_t data);
44
45work_t work_create_work(const work_param_t *param);
46
47int work_issue(work_t work, odp_event_t ev[], int num);
48
49void work_register_work(const char *name, work_init_fn_t init_fn, work_print_fn_t print_fn,
50 work_destroy_fn_t destroy_fn);
51
52void work_print_work(work_t work, const char *queue);
53
54void work_destroy_work(work_t work);
55
56#define WORK_AUTOREGISTER(name, init, print, destroy) \
57 __attribute__((constructor)) \
58 static void CONCAT(autoregister, __LINE__)(void) { \
59 work_register_work(name, init, print, destroy); \
60 }
61
62#endif
The OpenDataPlane API.