1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2019-2023 Broadcom 3 * All rights reserved. 4 */ 5 6 #ifndef _TF_TCAM_SHARED_H_ 7 #define _TF_TCAM_SHARED_H_ 8 9 #include "tf_core.h" 10 #include "tf_tcam.h" 11 12 /** 13 * @page tcam_shared TCAM SHARED 14 * 15 * @ref tf_tcam_shared_bind 16 * 17 * @ref tf_tcam_shared_unbind 18 * 19 * @ref tf_tcam_shared_alloc 20 * 21 * @ref tf_tcam_shared_free 22 * 23 * @ref tf_tcam_shared_set 24 * 25 * @ref tf_tcam_shared_get 26 * 27 * @ref tf_tcam_shared_move_p4 28 * 29 * @ref tf_tcam_shared_move_p58 30 * 31 * @ref tf_tcam_shared_clear 32 */ 33 34 /** 35 * Initializes the TCAM shared module with the requested DBs. Must be 36 * invoked as the first thing before any of the access functions. 37 * 38 * [in] tfp 39 * Pointer to the truflow handle 40 * 41 * [in] parms 42 * Pointer to parameters 43 * 44 * Returns 45 * - (0) if successful. 46 * - (-EINVAL) on failure. 47 */ 48 int tf_tcam_shared_bind(struct tf *tfp, 49 struct tf_tcam_cfg_parms *parms); 50 51 /** 52 * Cleans up the private DBs and releases all the data. 53 * 54 * [in] tfp 55 * Pointer to the truflow handle 56 * 57 * [in] parms 58 * Pointer to parameters 59 * 60 * Returns 61 * - (0) if successful. 62 * - (-EINVAL) on failure. 63 */ 64 int tf_tcam_shared_unbind(struct tf *tfp); 65 66 /** 67 * Allocates the requested tcam type from the internal RM DB. 68 * 69 * [in] tfp 70 * Pointer to the truflow handle 71 * 72 * [in] parms 73 * Pointer to parameters 74 * 75 * Returns 76 * - (0) if successful. 77 * - (-EINVAL) on failure. 78 */ 79 int tf_tcam_shared_alloc(struct tf *tfp, 80 struct tf_tcam_alloc_parms *parms); 81 82 /** 83 * Free's the requested table type and returns it to the DB. 84 * 85 * [in] tfp 86 * Pointer to the truflow handle 87 * 88 * [in] parms 89 * Pointer to parameters 90 * 91 * Returns 92 * - (0) if successful. 93 * - (-EINVAL) on failure. 94 */ 95 int tf_tcam_shared_free(struct tf *tfp, 96 struct tf_tcam_free_parms *parms); 97 98 /** 99 * Configures the requested element by sending a firmware request which 100 * then installs it into the device internal structures. 101 * 102 * [in] tfp 103 * Pointer to the truflow handle 104 * 105 * [in] parms 106 * Pointer to parameters 107 * 108 * Returns 109 * - (0) if successful. 110 * - (-EINVAL) on failure. 111 */ 112 int tf_tcam_shared_set(struct tf *tfp, 113 struct tf_tcam_set_parms *parms); 114 115 /** 116 * Retrieves the requested element by sending a firmware request to get 117 * the element. 118 * 119 * [in] tfp 120 * Pointer to the truflow handle 121 * 122 * [in] parms 123 * Pointer to parameters 124 * 125 * Returns 126 * - (0) if successful. 127 * - (-EINVAL) on failure. 128 */ 129 int tf_tcam_shared_get(struct tf *tfp, 130 struct tf_tcam_get_parms *parms); 131 132 /** 133 * Moves entries from the WC_TCAM_HI to the WC_TCAM_LO shared pools 134 * for the P4 device. 135 * 136 * [in] tfp 137 * Pointer to the truflow handle 138 * 139 * [in] parms 140 * Pointer to parameters 141 * 142 * Returns 143 * - (0) if successful. 144 * - (-EINVAL) on failure. 145 */ 146 int tf_tcam_shared_move_p4(struct tf *tfp, 147 struct tf_move_tcam_shared_entries_parms *parms); 148 149 /** 150 * Moves entries from the WC_TCAM_HI to the WC_TCAM_LO shared pools 151 * for the P58 device. 152 * 153 * [in] tfp 154 * Pointer to the truflow handle 155 * 156 * [in] parms 157 * Pointer to parameters 158 * 159 * Returns 160 * - (0) if successful. 161 * - (-EINVAL) on failure. 162 */ 163 int tf_tcam_shared_move_p58(struct tf *tfp, 164 struct tf_move_tcam_shared_entries_parms *parms); 165 166 /** 167 * Allocates and clears the entire WC_TCAM_HI or WC_TCAM_LO shared pools 168 * 169 * [in] tfp 170 * Pointer to the truflow handle 171 * 172 * [in] parms 173 * Pointer to parameters 174 * 175 * Returns 176 * - (0) if successful. 177 * - (-EINVAL) on failure. 178 */ 179 int tf_tcam_shared_clear(struct tf *tfp, 180 struct tf_clear_tcam_shared_entries_parms *parms); 181 #endif /* _TF_TCAM_SHARED_H */ 182