xref: /dpdk/lib/pipeline/rte_swx_extern.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 #ifndef __INCLUDE_RTE_SWX_EXTERN_H__
5 #define __INCLUDE_RTE_SWX_EXTERN_H__
6 
7 /**
8  * @file
9  * RTE SWX Extern objects and functions
10  *
11  * Extern object and extern function interfaces. The extern objects and extern
12  * functions provide the mechanisms to hook external functionality into the
13  * packet processing pipeline.
14  */
15 
16 #include <stdint.h>
17 
18 /*
19  * Extern type
20  */
21 
22 /**
23  * Extern object constructor
24  *
25  * @param[in] args
26  *   Extern object constructor arguments. It may be NULL.
27  * @return
28  *   Extern object handle.
29  */
30 typedef void *
31 (*rte_swx_extern_type_constructor_t)(const char *args);
32 
33 /**
34  * Extern object destructor
35  *
36  * @param[in] object
37  *   Extern object handle.
38  */
39 typedef void
40 (*rte_swx_extern_type_destructor_t)(void *object);
41 
42 /**
43  * Extern object member function
44  *
45  * The mailbox is used to pass input arguments to the member function and
46  * retrieve the output results. The mailbox mechanism allows for multiple
47  * concurrent executions of the same member function for the same extern object.
48  *
49  * Multiple invocations of the same member function may be required in order for
50  * the associated operation to complete. The completion is flagged by a return
51  * value of 1, in which case the results are available in the mailbox; in case
52  * of a return value of 0, the operation is not yet completed, so the member
53  * function must be invoked again with exactly the same object and mailbox
54  * arguments.
55  *
56  * @param[in] object
57  *   Extern object handle.
58  * @param[in] mailbox
59  *   Extern object mailbox.
60  * @return
61  *   0 when the operation is not yet completed, and 1 when the operation is
62  *   completed. No other return values are allowed.
63  */
64 typedef int
65 (*rte_swx_extern_type_member_func_t)(void *object, void *mailbox);
66 
67 /*
68  * Extern function
69  */
70 
71 /** The mailbox is used to pass input arguments to the extern function and
72  * retrieve the output results. The mailbox mechanism allows for multiple
73  * concurrent executions of the same extern function.
74  *
75  * Multiple invocations of the same extern function may be required in order for
76  * the associated operation to complete. The completion is flagged by a return
77  * value of 1, in which case the results are available in the mailbox; in case
78  * of a return value of 0, the operation is not yet completed, so the extern
79  * function must be invoked again with exactly the same mailbox argument.
80  *
81  * @param[in] mailbox
82  *   Extern object mailbox.
83  * @return
84  *   0 when the operation is not yet completed, and 1 when the operation is
85  *   completed. No other return values are allowed.
86  */
87 typedef int
88 (*rte_swx_extern_func_t)(void *mailbox);
89 
90 #endif
91