1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Broadcom
6 #ifndef _TF_SHADOW_TCAM_H_
7 #define _TF_SHADOW_TCAM_H_
12 * Shadow DB configuration information
14 * The shadow configuration is for all tcam table types for a direction
16 struct tf_shadow_tcam_cfg_parms {
18 * [in] The number of elements in the alloc_cnt and base_addr
19 * For now, it should always be equal to TF_TCAM_TBL_TYPE_MAX
23 * [in] Resource allocation count array
24 * This array content originates from the tf_session_resources
25 * that is passed in on session open
26 * Array size is TF_TCAM_TBL_TYPE_MAX
30 * [in] The base index for each tcam table
32 uint16_t base_addr[TF_TCAM_TBL_TYPE_MAX];
36 * Shadow TCAM DB creation parameters. The shadow db for this direction
39 struct tf_shadow_tcam_create_db_parms {
41 * [in] Receive or transmit direction
45 * [in] Configuration information for the shadow db
47 struct tf_shadow_tcam_cfg_parms *cfg;
49 * [out] Shadow tcam DB handle
55 * Create the shadow db for a single direction
57 * The returned shadow db must be free using the free db API when no longer
61 tf_shadow_tcam_create_db(struct tf_shadow_tcam_create_db_parms *parms);
64 * Shadow TCAM free parameters
66 struct tf_shadow_tcam_free_db_parms {
68 * [in] Shadow tcam DB handle
74 * Free all resources associated with the shadow db
77 tf_shadow_tcam_free_db(struct tf_shadow_tcam_free_db_parms *parms);
80 * Shadow TCAM bind index parameters
82 struct tf_shadow_tcam_bind_index_parms {
84 * [in] Shadow tcam DB handle
88 * [in] receive or transmit direction
92 * [in] TCAM table type
94 enum tf_tcam_tbl_type type;
96 * [in] index of the entry to program
100 * [in] struct containing key
104 * [in] struct containing mask fields
108 * [in] key size in bits (if search)
112 * [in] The hash bucket handled returned from the search
118 * Binds the allocated tcam index with the hash and shadow tables
121 tf_shadow_tcam_bind_index(struct tf_shadow_tcam_bind_index_parms *parms);
124 * Shadow TCAM insert parameters
126 struct tf_shadow_tcam_insert_parms {
128 * [in] Shadow tcam DB handle
132 * [in] The set parms from tf core
134 struct tf_tcam_set_parms *sparms;
138 * Set the entry into the tcam manager hash and shadow tables
140 * The search must have been used prior to setting the entry so that the
141 * hash has been calculated and duplicate entries will not be added
144 tf_shadow_tcam_insert(struct tf_shadow_tcam_insert_parms *parms);
147 * Shadow TCAM remove parameters
149 struct tf_shadow_tcam_remove_parms {
151 * [in] Shadow tcam DB handle
155 * [in,out] The set parms from tf core
157 struct tf_tcam_free_parms *fparms;
161 * Remove the entry from the tcam hash and shadow tables
163 * The search must have been used prior to setting the entry so that the
164 * hash has been calculated and duplicate entries will not be added
167 tf_shadow_tcam_remove(struct tf_shadow_tcam_remove_parms *parms);
170 * Shadow TCAM search parameters
172 struct tf_shadow_tcam_search_parms {
174 * [in] Shadow tcam DB handle
178 * [in,out] The search parameters from tf core
180 struct tf_tcam_alloc_search_parms *sparms;
182 * [out] The hash handle to use for the set
188 * Search for an entry in the tcam hash/shadow tables
190 * If there is a miss, but there is room for insertion, the hb_handle returned
191 * is used for insertion during the bind index API
194 tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms);