net/bnxt: update copyright year
[dpdk.git] / drivers / net / bnxt / tf_core / tf_identifier.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2021 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_IDENTIFIER_H_
7 #define _TF_IDENTIFIER_H_
8
9 #include "tf_core.h"
10
11 /**
12  * The Identifier module provides processing of Identifiers.
13  */
14
15 struct tf_ident_cfg_parms {
16         /**
17          * [in] Number of identifier types in each of the
18          * configuration arrays
19          */
20         uint16_t num_elements;
21         /**
22          * [in] Identifier configuration array
23          */
24         struct tf_rm_element_cfg *cfg;
25         /**
26          * [in] Boolean controlling the request shadow copy.
27          */
28         bool shadow_copy;
29         /**
30          * [in] Session resource allocations
31          */
32         struct tf_session_resources *resources;
33 };
34
35 /**
36  * Identifier allocation parameter definition
37  */
38 struct tf_ident_alloc_parms {
39         /**
40          * [in] receive or transmit direction
41          */
42         enum tf_dir dir;
43         /**
44          * [in] Identifier type
45          */
46         enum tf_identifier_type type;
47         /**
48          * [out] Identifier allocated
49          */
50         uint16_t *id;
51 };
52
53 /**
54  * Identifier free parameter definition
55  */
56 struct tf_ident_free_parms {
57         /**
58          * [in]  receive or transmit direction
59          */
60         enum tf_dir dir;
61         /**
62          * [in] Identifier type
63          */
64         enum tf_identifier_type type;
65         /**
66          * [in] ID to free
67          */
68         uint16_t id;
69         /**
70          * (experimental)
71          * [out] Current refcnt after free
72          */
73         uint32_t *ref_cnt;
74 };
75
76 /**
77  * Identifier search parameter definition
78  */
79 struct tf_ident_search_parms {
80         /**
81          * [in]  receive or transmit direction
82          */
83         enum tf_dir dir;
84         /**
85          * [in] Identifier type
86          */
87         enum tf_identifier_type type;
88         /**
89          * [in] Identifier data to search for
90          */
91         uint16_t search_id;
92         /**
93          * [out] Set if matching identifier found
94          */
95         bool *hit;
96         /**
97          * [out] Current ref count after allocation
98          */
99         uint32_t *ref_cnt;
100 };
101
102 /**
103  * @page ident Identity Management
104  *
105  * @ref tf_ident_bind
106  *
107  * @ref tf_ident_unbind
108  *
109  * @ref tf_ident_alloc
110  *
111  * @ref tf_ident_free
112  */
113
114 /**
115  * Initializes the Identifier module with the requested DBs. Must be
116  * invoked as the first thing before any of the access functions.
117  *
118  * [in] tfp
119  *   Pointer to TF handle, used for HCAPI communication
120  *
121  * [in] parms
122  *   Pointer to parameters
123  *
124  * Returns
125  *   - (0) if successful.
126  *   - (-EINVAL) on failure.
127  */
128 int tf_ident_bind(struct tf *tfp,
129                   struct tf_ident_cfg_parms *parms);
130
131 /**
132  * Cleans up the private DBs and releases all the data.
133  *
134  * [in] tfp
135  *   Pointer to TF handle, used for HCAPI communication
136  *
137  * [in] parms
138  *   Pointer to parameters
139  *
140  * Returns
141  *   - (0) if successful.
142  *   - (-EINVAL) on failure.
143  */
144 int tf_ident_unbind(struct tf *tfp);
145
146 /**
147  * Allocates a single identifier type.
148  *
149  * [in] tfp
150  *   Pointer to TF handle, used for HCAPI communication
151  *
152  * [in] parms
153  *   Pointer to parameters
154  *
155  * Returns
156  *   - (0) if successful.
157  *   - (-EINVAL) on failure.
158  */
159 int tf_ident_alloc(struct tf *tfp,
160                    struct tf_ident_alloc_parms *parms);
161
162 /**
163  * Free's a single identifier type.
164  *
165  * [in] tfp
166  *   Pointer to TF handle, used for HCAPI communication
167  *
168  * [in] parms
169  *   Pointer to parameters
170  *
171  * Returns
172  *   - (0) if successful.
173  *   - (-EINVAL) on failure.
174  */
175 int tf_ident_free(struct tf *tfp,
176                   struct tf_ident_free_parms *parms);
177
178 /**
179  * Search a single identifier type.
180  *
181  * [in] tfp
182  *   Pointer to TF handle, used for HCAPI communication
183  *
184  * [in] parms
185  *   Pointer to parameters
186  *
187  * Returns
188  *   - (0) if successful.
189  *   - (-EINVAL) on failure.
190  */
191 int tf_ident_search(struct tf *tfp,
192                     struct tf_ident_search_parms *parms);
193
194 #endif /* _TF_IDENTIFIER_H_ */