field_flush.h (9015B)
1 /** 2 * \file bcm_int/dnx/field/field_flush.h 3 * 4 * 5 * Field Flush definitions for database for DNX 6 */ 7 /* 8 * 9 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 10 * 11 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 12 */ 13 14 #ifndef FIELD_FIELD_FLUSH_H_INCLUDED 15 /* { */ 16 #define FIELD_FIELD_FLUSH_H_INCLUDED 17 18 #ifndef BCM_DNX_SUPPORT 19 #error "This file is for use by DNX (JR2) family only!" 20 #endif 21 /* 22 * Include files 23 * { 24 */ 25 26 /* 27 * } 28 */ 29 /* 30 * Defines 31 * { 32 */ 33 34 /** 35 * The size of the exem entry in the flush machine. 36 */ 37 #define DNX_FIELD_FLUSH_ENTRY_MAX_NOF_UINT32_IN_EXEM_ENTRY \ 38 ((DNX_DATA_MAX_FIELD_EXEM_LEARN_FLUSH_MACHINE_LEXEM_ENTRY_MAX_SIZE + SAL_UINT32_NOF_BITS - 1) / SAL_UINT32_NOF_BITS) 39 40 /* 41 * } 42 */ 43 /* 44 * Typedefs 45 * { 46 */ 47 48 /** 49 * Field flush machine for EXEM learning entry ID, indicating entry position on the TCAM. 50 */ 51 typedef int dnx_field_flush_entry_id_t; 52 53 /** 54 * Holds what to qualify upon in the qualifier of the EXEM entry for the flush machine entry. 55 */ 56 typedef struct 57 { 58 /** Dnx qualifier */ 59 dnx_field_qual_t dnx_qual; 60 /* 61 * The value to be compared against 62 */ 63 uint32 qual_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_QUAL_PARAMS_PER_ENTRY]; 64 /* 65 * The mask for what bits are to be compared 66 */ 67 uint32 qual_mask[DNX_DATA_MAX_FIELD_ENTRY_NOF_QUAL_PARAMS_PER_ENTRY]; 68 69 } dnx_field_flush_entry_key_qual_t; 70 71 /** 72 * Holds what to qualify upon in the action of the EXEM entry for the flush machine entry. 73 */ 74 typedef struct 75 { 76 /** Dnx action */ 77 dnx_field_action_t dnx_action; 78 /* 79 * The value to be compared against 80 */ 81 uint32 action_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_ACTION_PARAMS_PER_ENTRY]; 82 /* 83 * The mask for what bits are to be compared 84 */ 85 uint32 action_mask[DNX_DATA_MAX_FIELD_ENTRY_NOF_ACTION_PARAMS_PER_ENTRY]; 86 /* 87 * The value of the valid bit to be compared (for actions that have a valid bit). 88 */ 89 uint8 valid_bit_value; 90 /* 91 * Whether to check the valid bit (for actions that have valid bit). 92 */ 93 uint8 valid_bit_mask; 94 95 } dnx_field_flush_entry_key_action_t; 96 97 /** 98 * Holds the in params for adding a TCAM entry to the EXEM learn flush machine, 99 * the values to be qualified upon 100 */ 101 typedef struct 102 { 103 /* 104 * The array of qualifiers from the key of the EXEM entry we qualify upon to 105 * check in the flush entry. 106 */ 107 dnx_field_flush_entry_key_qual_t qual_info[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]; 108 109 /* 110 * The array of actions from the payload of the EXEM entry we qualify upon to 111 * check in the flush entry. 112 */ 113 dnx_field_flush_entry_key_action_t action_info[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP]; 114 115 /* 116 * The value to expect from the hit bit 117 */ 118 uint8 hit_bit_value; 119 120 /* 121 * Whether to check the hit bit 122 */ 123 uint8 hit_bit_mask; 124 125 } dnx_field_flush_entry_key_t; 126 127 /** 128 * Holds information should be changed for the action the payload of the EXEM entry if the 129 * flush machine entry hits. 130 */ 131 typedef struct 132 { 133 /** Dnx action */ 134 dnx_field_action_t dnx_action; 135 /* 136 * The value to be written to the action 137 */ 138 uint32 action_value[DNX_DATA_MAX_FIELD_ENTRY_NOF_ACTION_PARAMS_PER_ENTRY]; 139 /* 140 * The mask for what bits to be changed 141 */ 142 uint32 action_altering_mask[DNX_DATA_MAX_FIELD_ENTRY_NOF_ACTION_PARAMS_PER_ENTRY]; 143 /* 144 * The value of the valid bit to be written(for actions that have a valid bit). 145 */ 146 uint8 valid_bit_value; 147 /* 148 * Whether to change the valid bit (for actions that have valid bit). 149 */ 150 uint8 valid_bit_mask; 151 152 } dnx_field_flush_entry_payload_altering_action_t; 153 154 /** 155 * Holds the in params for adding a TCAM entry to the EXEM learn flush machine, 156 * the values to be qualified upon 157 */ 158 typedef struct 159 { 160 /* 161 * Whether to clear the hit bit of the EXEM entry. 162 */ 163 uint8 hit_bit_clear; 164 /* 165 * Whether to delete the EXEM entry. 166 */ 167 uint8 delete; 168 /* 169 * Whether to edit the EXEM entry. 170 */ 171 uint8 transplant; 172 /* 173 * The array of actions from the payload of the EXEM entry we change if the flush entry hits. 174 */ 175 dnx_field_flush_entry_key_action_t action_info[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP]; 176 177 } dnx_field_flush_entry_payload_t; 178 179 /** 180 * Holds the in params for adding a TCAM entry to the EXEM learn flush machine 181 */ 182 typedef struct 183 { 184 /** Hold the What should be qualified upon in the TCAM (including the full EXEM entry).*/ 185 dnx_field_flush_entry_key_t key_info; 186 187 /** Hold The changes to the payload and commands to be performed if the entry is hit.*/ 188 dnx_field_flush_entry_payload_t payload_info; 189 190 } dnx_field_flush_entry_t; 191 192 /* 193 * } Types 194 */ 195 196 /** 197 * \brief - Configures the given EXEM index with the given scan 198 * period. 199 * 200 * \param [in] unit - Relevant unit. 201 * \param [in] exem_index - exem index to configure. 202 * \param [in] scan_period_us - the scan period in uSec. 203 * 204 * \remark 205 * None 206 * \see 207 * 208 * * None 209 */ 210 shr_error_e dnx_switch_control_exem_scan_period_set( 211 int unit, 212 int exem_index, 213 uint32 scan_period_us); 214 215 /** 216 * \brief - Retrieves EXEM scan period. 217 * 218 * \param [in] unit - Relevant unit. 219 * \param [in] exem_index - exem index to retrive its scan 220 * period. 221 * \param [out] scan_period_us - the scan period in uSec. 222 * 223 * \remark 224 * None 225 * \see 226 * 227 * * None 228 */ 229 shr_error_e dnx_switch_control_exem_scan_period_get( 230 int unit, 231 int exem_index, 232 uint32 *scan_period_us); 233 234 /** 235 * \brief - Configures the given EXEM flush profile payload offset 236 * period. 237 * 238 * \param [in] unit - Relevant unit. 239 * \param [in] exem_index - exem index to configure. 240 * \param [in] payload_offset - the flush profile payload offset. 241 * 242 * \remark 243 * None 244 * \see 245 * 246 * * None 247 */ 248 shr_error_e dnx_switch_control_exem_flush_profile_payload_offset_set( 249 int unit, 250 int exem_index, 251 uint32 payload_offset); 252 253 /** 254 * \brief - Retrieves EXEM flush profile payload offset. 255 * 256 * \param [in] unit - Relevant unit. 257 * \param [in] exem_index - exem index to retrive its scan 258 * period. 259 * \param [out] payload_offset - the flush profile payload offset. 260 * 261 * \remark 262 * None 263 * \see 264 * 265 * * None 266 */ 267 shr_error_e dnx_switch_control_exem_flush_profile_payload_offset_get( 268 int unit, 269 int exem_index, 270 uint32 *payload_offset); 271 272 /** 273 * \brief 274 * Init structure type of dnx_field_flush_entry_t. 275 * \param [in] unit - Device ID. 276 * \param [in] flush_entry_info_p - Pointer to structure type of dnx_field_flush_entry_t. 277 * \return 278 * shr_error_e - Error Type 279 * \remark 280 * * None 281 * \see 282 * * None 283 */ 284 shr_error_e dnx_field_flush_entry_t_init( 285 int unit, 286 dnx_field_flush_entry_t * flush_entry_info_p); 287 288 /** 289 * \brief 290 * Add an entry to the TCAM of the flush machine for EXEM learn. 291 * \param [in] unit - Device ID. 292 * \param [in] flags - The flags for the entry add. 293 * \param [in] fg_id - The EXEM field group upon which we qualify. 294 * \param [in] entry_id - The number of the entry in the TCAM. 295 * \param [in] flush_entry_info_p - The parameters of the entry to be added. 296 * \return 297 * shr_error_e - Error Type 298 * \remark 299 * * None 300 * \see 301 * * None 302 */ 303 shr_error_e dnx_field_flush_machine_entry_add( 304 int unit, 305 uint32 flags, 306 dnx_field_group_t fg_id, 307 dnx_field_flush_entry_id_t entry_id, 308 dnx_field_flush_entry_t * flush_entry_info_p); 309 310 /** 311 * \brief 312 * Get an entry to the TCAM of the flush machine for EXEM learn. 313 * \param [in] unit - Device ID. 314 * \param [in] flags - The flags for the entry add. 315 * \param [in] fg_id - The EXEM field group upon which we qualify. 316 * \param [in] entry_id - The number of the entry in the TCAM. 317 * \param [out] flush_entry_info_p - The parameters of the entry. 318 * \return 319 * shr_error_e - Error Type 320 * \remark 321 * * None 322 * \see 323 * * None 324 */ 325 shr_error_e dnx_field_flush_machine_entry_get( 326 int unit, 327 uint32 flags, 328 dnx_field_group_t fg_id, 329 dnx_field_flush_entry_id_t entry_id, 330 dnx_field_flush_entry_t * flush_entry_info_p); 331 332 /** 333 * \brief 334 * Delete an entry from the TCAM of the flush machine for EXEM learn. 335 * \param [in] unit - Device ID. 336 * \param [in] flags - The flags for the entry delete. 337 * \param [in] fg_id - The EXEM field group upon which the entry qualifies. 338 * \param [in] entry_id - The number of the entry in the TCAM. 339 * \return 340 * shr_error_e - Error Type 341 * \remark 342 * * None 343 * \see 344 * * None 345 */ 346 shr_error_e dnx_field_flush_machine_entry_delete( 347 int unit, 348 uint32 flags, 349 dnx_field_group_t fg_id, 350 dnx_field_flush_entry_id_t entry_id); 351 352 /* } */ 353 354 #endif