1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
6 #ifndef _TF_SHADOW_IDENTIFIER_H_
7 #define _TF_SHADOW_IDENTIFIER_H_
14 * The Shadow Identifier module provides shadow DB handling for identifier based
15 * TF types. A shadow DB provides the capability that allows for reuse
18 * A Shadow identifier DB is intended to be used by the Identifier Type module
23 * Shadow DB configuration information for a single identifier type.
25 * It is used in an array of identifier types. The array must be ordered
26 * by the TF type is represents.
28 struct tf_shadow_ident_cfg_parms {
32 enum tf_identifier_type type;
35 * Number of entries the Shadow DB needs to hold
40 * Resource allocation count array. This array content
41 * originates from the tf_session_resources that is passed in
43 * Array size is num_elements.
49 * Shadow identifier DB creation parameters
51 struct tf_shadow_ident_create_db_parms {
53 * [in] Receive or transmit direction.
57 * [in] Configuration information for the shadow db
59 struct tf_shadow_ident_cfg_parms *cfg;
61 * [in] Number of elements in the parms structure
63 uint16_t num_elements;
65 * [out] Shadow identifier DB handle
67 void **tf_shadow_ident_db;
71 * Shadow identifier DB free parameters
73 struct tf_shadow_ident_free_db_parms {
75 * Shadow identifier DB handle
77 void *tf_shadow_ident_db;
81 * Shadow identifier search parameters
83 struct tf_shadow_ident_search_parms {
85 * [in] Shadow identifier DB handle
87 void *tf_shadow_ident_db;
89 * [in] Identifier type
91 enum tf_identifier_type type;
97 * [out] Index of the found element returned if hit
101 * [out] Reference count incremented if hit
107 * Shadow identifier insert parameters
109 struct tf_shadow_ident_insert_parms {
111 * [in] Shadow identifier DB handle
113 void *tf_shadow_ident_db;
117 enum tf_identifier_type type;
119 * [in] Entry to update
123 * [out] Reference count after insert
129 * Shadow identifier remove parameters
131 struct tf_shadow_ident_remove_parms {
133 * [in] Shadow identifier DB handle
135 void *tf_shadow_ident_db;
139 enum tf_identifier_type type;
141 * [in] Entry to update
145 * [out] Reference count after removal
151 * @page shadow_ident Shadow identifier DB
153 * @ref tf_shadow_ident_create_db
155 * @ref tf_shadow_ident_free_db
157 * @reg tf_shadow_ident_search
159 * @reg tf_shadow_ident_insert
161 * @reg tf_shadow_ident_remove
165 * Creates and fills a Shadow identifier DB. The DB is indexed per the
169 * Pointer to create db parameters
172 * - (0) if successful.
173 * - (-EINVAL) on failure.
175 int tf_shadow_ident_create_db(struct tf_shadow_ident_create_db_parms *parms);
178 * Closes the Shadow identifier DB and frees all allocated
179 * resources per the associated database.
182 * Pointer to the free DB parameters
185 * - (0) if successful.
186 * - (-EINVAL) on failure.
188 int tf_shadow_ident_free_db(struct tf_shadow_ident_free_db_parms *parms);
191 * Search Shadow identifier db for matching result
194 * Pointer to the search parameters
197 * - (0) if successful, element was found.
198 * - (-EINVAL) on failure.
200 int tf_shadow_ident_search(struct tf_shadow_ident_search_parms *parms);
203 * Inserts an element into the Shadow identifier DB. Ref_count after insert
204 * will be incremented.
207 * Pointer to insert parameters
210 * - (0) if successful.
211 * - (-EINVAL) on failure.
213 int tf_shadow_ident_insert(struct tf_shadow_ident_insert_parms *parms);
216 * Removes an element from the Shadow identifier DB. Will fail if the
217 * elements ref_count is 0. Ref_count after removal will be
221 * Pointer to remove parameter
224 * - (0) if successful.
225 * - (-EINVAL) on failure.
227 int tf_shadow_ident_remove(struct tf_shadow_ident_remove_parms *parms);
229 #endif /* _TF_SHADOW_IDENTIFIER_H_ */