pipeline: add SWX pipeline tables
[dpdk.git] / lib / librte_pipeline / rte_swx_ctl.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 #ifndef __INCLUDE_RTE_SWX_CTL_H__
5 #define __INCLUDE_RTE_SWX_CTL_H__
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 /**
12  * @file
13  * RTE SWX Pipeline Control
14  */
15
16 #include <stddef.h>
17 #include <stdint.h>
18
19 #include <rte_compat.h>
20
21 #include "rte_swx_table.h"
22
23 /*
24  * Table Update API.
25  */
26
27 /** Table state. */
28 struct rte_swx_table_state {
29         /** Table object. */
30         void *obj;
31
32         /** Action ID of the table default action. */
33         uint64_t default_action_id;
34
35         /** Action data of the table default action. Ignored when the action
36          * data size is zero; otherwise, action data size bytes are meaningful.
37          */
38         uint8_t *default_action_data;
39 };
40
41 /**
42  * Pipeline table state get
43  *
44  * @param[in] p
45  *   Pipeline handle.
46  * @param[out] table_state
47  *   After successful execution, the *table_state* contains the pointer to the
48  *   current pipeline table state, which is an array of *n_tables* elements,
49  *   with array element i containing the state of the i-th pipeline table. The
50  *   pipeline continues to own all the data structures directly or indirectly
51  *   referenced by the *table_state* until the subsequent successful invocation
52  *   of function *rte_swx_pipeline_table_state_set*.
53  * @return
54  *   0 on success or the following error codes otherwise:
55  *   -EINVAL: Invalid argument.
56  */
57 __rte_experimental
58 int
59 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
60                                  struct rte_swx_table_state **table_state);
61
62 /**
63  * Pipeline table state set
64  *
65  * @param[in] p
66  *   Pipeline handle.
67  * @param[out] table_state
68  *   After successful execution, the pipeline table state is updated to this
69  *   *table_state*. The ownership of all the data structures directly or
70  *   indirectly referenced by this *table_state* is passed from the caller to
71  *   the pipeline.
72  * @return
73  *   0 on success or the following error codes otherwise:
74  *   -EINVAL: Invalid argument.
75  */
76 __rte_experimental
77 int
78 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
79                                  struct rte_swx_table_state *table_state);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif