policer.h (41885B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 * 7 * This file contains Service meters(global meters) definitions internal 8 * to the BCM library. 9 */ 10 #ifndef _BCM_INT_SVC_METER_H 11 #define _BCM_INT_SVC_METER_H 12 13 14 #include <shared/bsl.h> 15 16 #include <bcm/types.h> 17 #include <sal/core/libc.h> 18 #include <soc/mem.h> 19 #include <soc/debug.h> 20 #include <soc/drv.h> 21 #include <soc/l2x.h> 22 #include <bcm/error.h> 23 #include <bcm/policer.h> 24 #include <soc/mcm/memregs.h> 25 26 #define BCM_POLICER_TYPE_REGEX 0x1 27 #define BCM_POLICER_TYPE_SHIFT 24 28 #define BCM_POLICER_TYPE_MASK 0x0f000000 29 #define BCM_POLICER_IS_REGEX_METER(policer_id) \ 30 ((((policer_id) & BCM_POLICER_TYPE_MASK) >> BCM_POLICER_TYPE_SHIFT)== BCM_POLICER_TYPE_REGEX) 31 32 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_CNG_ATTR_BITS 0x00000001 33 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_INT_PRI_ATTR_BITS 0x00000002 34 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_VLAN_FORMAT_ATTR_BITS 0x00000004 35 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_OUTER_DOT1P_ATTR_BITS 0x00000008 36 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_INNER_DOT1P_ATTR_BITS 0x00000010 37 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_INGRESS_PORT_ATTR_BITS 0x00000020 38 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_TOS_ATTR_BITS 0x00000040 39 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_PKT_RESOLUTION_ATTR_BITS 0x00080 40 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_SVP_TYPE_ATTR_BITS 0x00000100 41 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_DROP_ATTR_BITS 0x00000200 42 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_IP_PKT_ATTR_BITS 0x00000400 43 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_SHORT_INT_PRI_ATTR_BITS 0x00000800 44 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_TOS_ECN_ATTR_BITS 0x00001000 45 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_PREEMPTABLE_ATTR_BITS 0x00002000 46 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_ETHERTYPE_ATTR_BITS 0x00004000 47 /* UDF to be the highest bit */ 48 #define BCM_POLICER_SVC_METER_UNCOMPRESSED_USE_UDF_ATTR_BITS 0x80000000 49 50 #define BCM_SVC_METER_PORT_MAP_SIZE 172 51 #define BCM_SVC_METER_MAP_SIZE_64 64 52 #define BCM_SVC_METER_MAP_SIZE_256 256 53 #define BCM_SVC_METER_MAP_SIZE_1024 1024 54 55 #define BCM_POLICER_SVC_METER_MAX_MODE 4 56 #define BCM_POLICER_SVC_METER_OFFSET_TABLE_KEY_SIZE 8 57 #define BCM_POLICER_SVC_METER_OFFSET_TABLE_MAX_INDEX 4 58 #define BCM_POLICER_SVC_METER_MAX_OFFSET 256 59 #define BCM_POLICER_SVC_METER_MAX_ATTR_SELECTORS 256 60 #define SVC_METER_UDF_MAX_BIT_POSITION 16 61 #define SVC_METER_UDF1_MAX_BIT_POSITION 32 62 #define SVC_METER_UDF1_VALID 0x1 63 #define SVC_METER_UDF2_VALID 0x2 64 #define SVC_METER_UDF_MAX_SUB_DIVISIONS \ 65 BCM_POLICER_SVC_METER_OFFSET_TABLE_KEY_SIZE 66 #define SVC_METER_MAX_SELECTOR_BITS \ 67 BCM_POLICER_SVC_METER_OFFSET_TABLE_KEY_SIZE 68 69 #define BCM_POLICER_SVC_METER_CNG_ATTR_SIZE 2 70 #define BCM_POLICER_SVC_METER_IFP_ATTR_SIZE 2 71 #define BCM_POLICER_SVC_METER_INT_PRI_ATTR_SIZE 4 72 #define BCM_POLICER_SVC_METER_SHORT_INT_PRI_ATTR_SIZE 3 73 #define BCM_POLICER_SVC_METER_VLAN_FORMAT_ATTR_SIZE 2 74 #define BCM_POLICER_SVC_METER_OUTER_DOT1P_ATTR_SIZE 3 75 #define BCM_POLICER_SVC_METER_INNER_DOT1P_ATTR_SIZE 3 76 #define BCM_POLICER_SVC_METER_ING_PORT_ATTR_SIZE 6 77 #define BCM_POLICER_SVC_METER_TOS_ATTR_SIZE 6 78 #define BCM_POLICER_SVC_METER_TOS_ECN_ATTR_SIZE 2 79 #define BCM_POLICER_SVC_METER_PKT_REOLUTION_ATTR_SIZE 6 80 #define BCM_POLICER_SVC_METER_SVP_TYPE_ATTR_SIZE 1 81 #define BCM_POLICER_SVC_METER_SVP_NETWORK_GROUP_ATTR_SIZE 3 82 #define BCM_POLICER_SVC_METER_DROP_ATTR_SIZE 1 83 #define BCM_POLICER_SVC_METER_IP_PKT_ATTR_SIZE 1 84 #define BCM_POLICER_SVC_METER_KT2_ING_PORT_ATTR_SIZE 8 85 #define BCM_POLICER_SVC_METER_SB2_ING_PORT_ATTR_SIZE 7 86 87 #define BCM_POLICER_GLOBAL_METER_INDEX_MASK 0x1FFFFFFF 88 #define BCM_POLICER_GLOBAL_METER_MODE_MASK 0xE0000000 89 #define BCM_POLICER_GLOBAL_METER_MODE_SHIFT 29 90 #define BCM_POLICER_GLOBAL_METER_NO_OFFSET_MODE 0x20000000 91 #define BCM_POLICER_GLOBAL_METER_DISABLE 0x1 92 #define BCM_POLICER_GLOBAL_METER_MAX_POOL 8 93 #define BCM_POLICER_GLOBAL_METER_MAX_BANKS_PER_POOL 2 94 #define BCM_POLICER_GLOBAL_METER_GROUP_MODE_TYPE_MASK 0xFF000000 95 #define BCM_POLICER_GLOBAL_METER_GROUP_MODE_TYPE_SHIFT 24 96 97 #define BCM_POLICER_GLOBAL_METER_ACTION_CHANGE_INT_PRI_BIT_POS 16 98 #define BCM_POLICER_GLOBAL_METER_ACTION_CHANGE_ECN_BIT_POS 17 99 #define BCM_POLICER_GLOBAL_METER_ACTION_CHANGE_DOT1P_BIT_POS 18 100 #define BCM_POLICER_GLOBAL_METER_ACTION_CHANGE_CNG_BIT_POS 19 101 #define BCM_POLICER_GLOBAL_METER_ACTION_CHANGE_DSCP_BIT_POS 21 102 103 #define BCM_POLICER_GLOBAL_METER_ACTION_ECN_BIT_POS 0 104 #define BCM_POLICER_GLOBAL_METER_ACTION_DSCP_BIT_POS 2 105 #define BCM_POLICER_GLOBAL_METER_ACTION_DOT1P_BIT_POS 8 106 #define BCM_POLICER_GLOBAL_METER_ACTION_DROP_BIT_POS 11 107 #define BCM_POLICER_GLOBAL_METER_ACTION_INT_PRI_BIT_POS 12 108 109 110 #define BCM_POLICER_GLOBAL_METER_ACTION_DSCP_MASK 0xfc 111 #define BCM_POLICER_GLOBAL_METER_ACTION_DOT1P_MASK 0x700 112 #define BCM_POLICER_GLOBAL_METER_ACTION_INT_PRI_MASK 0xf000 113 #define BCM_POLICER_GLOBAL_METER_ACTION_SHORT_INT_PRI_MASK 0x7000 114 #define BCM_POLICER_GLOBAL_METER_ACTION_ECN_MASK 0x3 115 #define BCM_POLICER_GLOBAL_METER_ACTION_CNG_MASK 0x180000 116 117 #define BCM_POLICER_GLOBAL_METER_MAX_ACTIONS 8192 118 119 #define GLOBAL_METER_ALLOC_VERTICAL 0x0 120 #define GLOBAL_METER_ALLOC_HORIZONTAL 0x1 121 122 123 #define GLOBAL_METER_REFRESH_MAX_DISABLE_LIMIT 0x1f 124 #define GLOBAL_METER_MODE_DEFAULT 0x0 125 #define GLOBAL_METER_MODE_CASCADE 0x1 126 #define GLOBAL_METER_MODE_TR_TCM 0x2 127 #define GLOBAL_METER_MODE_TR_TCM_MODIFIED 0x3 128 #define GLOBAL_METER_MODE_SR_TCM 0x4 129 #define GLOBAL_METER_MODE_SR_TCM_MODIFIED 0x5 130 131 #define BCM_GLOBAL_METER_MAX_SCACHE_ENTRIES 16 132 /* Mode Id = 0 is used only to create policer group with 1 policer 133 * member. So, it basically do not store any information which 134 * require storing to scache. Hence, not allocating size to it. 135 */ 136 #define BCM_GLOBAL_METER_MAX_SCACHEABLE_GROUP_MODE (BCM_POLICER_SVC_METER_MAX_MODE - 1) 137 138 /* Generic memory allocation routine. */ 139 #define _GLOBAL_METER_XGS3_ALLOC(_ptr_,_size_,_descr_) \ 140 do { \ 141 if (NULL == (_ptr_)) { \ 142 (_ptr_) = sal_alloc((_size_), (_descr_)); \ 143 } \ 144 if((_ptr_) != NULL) { \ 145 sal_memset((_ptr_), 0, (_size_)); \ 146 } else { \ 147 LOG_ERROR(BSL_LS_BCM_POLICER, \ 148 (BSL_META("Error:Alloc failure %s\n"), (_descr_))); \ 149 } \ 150 } while (0) 151 152 #define _GLOBAL_METER_HASH_SIZE 0x100 153 #define _GLOBAL_METER_HASH_MASK 0xff 154 155 156 157 #define _GLOBAL_METER_HASH_INSERT(_hash_ptr_, _inserted_ptr_, _index_) \ 158 do { \ 159 (_inserted_ptr_)->next = (_hash_ptr_)[(_index_)]; \ 160 (_hash_ptr_)[(_index_)] = (_inserted_ptr_); \ 161 } while (0) 162 163 #define _GLOBAL_METER_HASH_REMOVE(_hash_ptr_, _entry_type_, _removed_ptr_, _index_) \ 164 do { \ 165 _entry_type_ *_prev_ent_ = NULL; \ 166 _entry_type_ *_lkup_ent_ = (_hash_ptr_)[(_index_)]; \ 167 while (NULL != _lkup_ent_) { \ 168 if (_lkup_ent_ != (_removed_ptr_)) { \ 169 _prev_ent_ = _lkup_ent_; \ 170 _lkup_ent_ = _lkup_ent_->next; \ 171 continue; \ 172 } \ 173 if (_prev_ent_!= NULL) { \ 174 _prev_ent_->next = (_removed_ptr_)->next; \ 175 } else { \ 176 (_hash_ptr_)[(_index_)] = (_removed_ptr_)->next; \ 177 } \ 178 break; \ 179 } \ 180 } while (0) 181 182 #define BCM_SVM_DMA_CHUNK_SIZE 4096 183 184 /* Policer service meter Modes. */ 185 typedef enum bcm_policer_svc_meter_mode_type_e { 186 uncompressed_mode,/*service meter uncompressed mode*/ 187 compressed_mode, /* service meter compressed mode */ 188 udf_mode, /* service meter in udf mode */ 189 cascade_mode, 190 cascade_with_coupling_mode, 191 udf_cascade_mode, 192 udf_cascade_with_coupling_mode 193 } bcm_policer_svc_meter_mode_type_t; 194 195 /* bcm_policer_svc_meter_mode_t */ 196 typedef uint32 bcm_policer_svc_meter_mode_t; 197 198 /* compressed_pri_cnf_attr_map_t */ 199 typedef uint8 compressed_pri_cnf_attr_map_t; 200 201 /* compressed_pkt_pri_attr_map_t */ 202 typedef uint8 compressed_pkt_pri_attr_map_t; 203 204 /* compressed_port_attr_map_t */ 205 typedef uint8 compressed_port_attr_map_t; 206 207 /* compressed_tos_attr_map_t */ 208 typedef uint8 compressed_tos_attr_map_t; 209 210 /* compressed_pkt_res_attr_map_t */ 211 typedef uint8 compressed_pkt_res_attr_map_t; 212 213 /* offset_table_map_t */ 214 typedef struct offset_table_entry_s { 215 uint8 offset; 216 uint8 meter_enable; 217 uint8 pool; 218 } offset_table_entry_t; 219 220 typedef struct bcm_policer_svc_meter_uncompressed_attr_selectors_s { 221 uint32 uncompressed_attr_bits_selector; 222 offset_table_entry_t offset_map[BCM_SVC_METER_MAP_SIZE_256]; 223 } uncompressed_attr_selectors_t; 224 225 typedef struct bcm_policer_svc_meter_pkt_attr_bits_s { 226 uint8 cng; /* CNG bits - corresponds to 2 bits in uncompressed 227 mode */ 228 uint8 cng_pos; 229 uint8 cng_mask; 230 uint8 int_pri; /* internal priority bits -corresponds to 4 bits in 231 uncompressed mode */ 232 uint8 int_pri_pos; 233 uint8 int_pri_mask; 234 uint8 short_int_pri; /* internal priority bits -corresponds to 3 bits in 235 uncompressed mode */ 236 uint8 short_int_pri_pos; 237 uint8 short_int_pri_mask; 238 uint8 vlan_format; /* vlan format - corresponds to 2 bits in 239 uncompressed mode */ 240 uint8 vlan_format_pos; 241 uint8 vlan_format_mask; 242 uint8 outer_dot1p; /* outer 802.1p - corresponds to 3 bits in 243 uncompressed mode */ 244 uint8 outer_dot1p_pos; 245 uint8 outer_dot1p_mask; 246 uint8 inner_dot1p; /* inner 802.1p - corresponds to 3 bits in 247 uncompressed mode */ 248 uint8 inner_dot1p_pos; 249 uint8 inner_dot1p_mask; 250 uint8 ing_port; /* ingress port - corresponds to 6 bits in 251 uncompressed mode */ 252 uint8 ing_port_pos; 253 uint8 ing_port_mask; 254 uint8 tos; /* tos bits DSCP - corresponds to 6 bits in uncompressed 255 mode */ 256 uint8 tos_pos; 257 uint8 tos_mask; 258 uint8 tos_ecn; /* tos ecn bits - corresponds to 2 bits in uncompressed 259 mode */ 260 uint8 tos_ecn_pos; 261 uint8 tos_ecn_mask; 262 uint8 pkt_resolution; /* packet resolution - corresponds to 6 bits in 263 uncompressed mode */ 264 uint8 pkt_res_pos; 265 uint8 pkt_res_mask; 266 uint8 svp_type; /* svp type - corresponds to 1 bit in uncompressed 267 mode */ 268 uint8 svp_type_pos; 269 uint8 svp_type_mask; 270 uint8 drop; /* use drop bit -corresponds to 1 bit in 271 uncompressed mode */ 272 uint8 drop_pos; 273 uint8 drop_mask; 274 uint8 ip_pkt; /* corresponds to 1 bit in uncompressed mode */ 275 uint8 ip_pkt_pos; 276 uint8 ip_pkt_mask; 277 uint8 preemptable_pkt; /* preemptable_pkt */ 278 uint32 ethernet_type; /* ethernet_type */ 279 } pkt_attr_bits_t; 280 281 typedef struct bcm_policer_svc_meter_udf_pkt_attr_bits_s { 282 uint8 udf0; /* Represents bits to be used from UDF0 in udf mode */ 283 uint8 udf1; /* Represents bits to be used from UDF1 in udf mode */ 284 } udf_pkt_attr_bits_t; 285 286 #if defined(BCM_GLOBAL_METER_V2_SUPPORT) 287 #define BCMI_POLICER_GLOBAL_METER_ATTR_MASK_ALL (0xFF) 288 #define BCMI_POLICER_GLOBAL_METER_INVALID_ACTION_ID (0) 289 290 typedef struct pkt_tcam_attr_bits_s { 291 /* TCAM SW information */ 292 uint32 ref_count; 293 uint32 mode_id; 294 uint32 attr_bits_selector; 295 /* TCAM HW information */ 296 uint32 tcam_idx; /* TCAM index */ 297 uint8 final_offset; /* final_offset */ 298 uint8 offset_mode; /* offset_mode */ 299 udf_pkt_attr_bits_t udf, udf_mask; 300 uint32 value[bcmPolicerGroupModeAttrCount]; 301 uint32 value_mask[bcmPolicerGroupModeAttrCount]; 302 } pkt_tcam_attr_bits_t; 303 304 void pkt_tcam_attr_bits_t_init(pkt_tcam_attr_bits_t *attr); 305 306 /* 307 * Typedef: 308 * bcmi_global_meter_policer_t 309 * Purpose: 310 * This is the policer description structure. 311 * Indexed by bcm_policer_t handle. 312 */ 313 typedef struct bcmi_global_meter_policer_control_s { 314 bcm_policer_t pid; /* Unique policer identifier */ 315 uint16 ref_count; /* SW object use reference count */ 316 bcm_policer_config_t *pol_cfg; /* policer config of each policer */ 317 uint32 no_of_policers; 318 bcm_policer_group_mode_t grp_mode; 319 struct bcmi_global_meter_policer_control_s *next; /* lookup linked list */ 320 } bcmi_global_meter_policer_control_t; 321 322 /* Structure to store which attributes are used by user (for complete list) */ 323 typedef struct bcmi_policer_tcam_attr_selectors_s { 324 uint32 total_policers; 325 uint32 pkt_attr_v_cnt; /* Number of multiple elements specified 326 in all of the pkt_attr_v[] array */ 327 pkt_tcam_attr_bits_t *pkt_attr_v; /* TCAM information */ 328 } bcmi_policer_tcam_attr_selectors_t; 329 330 typedef struct bcmi_policer_svm_offset_mode_bk_s { 331 uint8 is_custom_group; /* TRUE : created by policer_group_create 332 FALSE : created by custom_group_mode_id_create */ 333 uint32 ref_cnt; 334 uint32 used; 335 bcm_policer_group_mode_t group_mode; 336 bcm_policer_group_mode_type_t group_mode_type; 337 uint32 no_of_policers; 338 uint32 no_of_attr_selectors; 339 bcm_policer_group_mode_attr_selector_t *attr_selectors; 340 uint32 pkt_attr_v_cnt; /* Number of multiple elements specified 341 in all of the pkt_attr_v[] array */ 342 pkt_tcam_attr_bits_t *pkt_attr_v; /* TCAM information */ 343 } bcmi_policer_svm_offset_mode_bk_t; 344 345 typedef struct bcmi_policer_svm_bk_s { 346 /* Store TCAM information */ 347 SHR_BITDCL *tcam_intf_bitmap; 348 uint32 valid_tcam_idx_cnt; 349 uint32 valid_tcam_idx_start; 350 uint32 valid_tcam_idx_end; 351 uint32 empty_tcam_idx_cnt; 352 uint32 empty_tcam_idx_start; 353 uint32 empty_tcam_idx_end; 354 /* Store Offset Mode information */ 355 bcmi_policer_svm_offset_mode_bk_t *offset_mode_v; 356 SHR_BITDCL *offset_mode_intf_bitmap; 357 uint32 valid_offset_mode_cnt; 358 uint32 valid_offset_mode_start; 359 uint32 valid_offset_mode_end; 360 uint32 empty_offset_mode_cnt; 361 uint32 empty_offset_mode_start; 362 uint32 empty_offset_mode_end; 363 sal_mutex_t mutex; 364 } bcmi_policer_svm_bk_t; 365 366 typedef struct bcmi_policer_global_meter_action_bk_s { 367 uint32 used; 368 uint32 reference_count; 369 bcm_policer_action_t actions[bcmPolicerActionCount]; 370 uint32 param[bcmPolicerActionCount]; 371 uint32 actions_count; 372 } bcmi_policer_global_meter_action_bk_t; 373 374 #endif /* BCM_GLOBAL_METER_V2_SUPPORT */ 375 376 typedef enum bcm_policer_attr_with_value_e { 377 _bcmPolicerAttrPort = 0, 378 _bcmPolicerAttrTosDscp = 1, 379 _bcmPolicerAttrTosEcn = 2, 380 _bcmPolicerAttrSvpType = 3, 381 _bcmPolicerAttrMax = 4 382 } bcm_policer_attr_with_value_t; 383 384 /* Out of above attr_with_value, ing_port can have highest value 385 * Taking Maximum bits required as 180 even though port is 169 (in Kt2) */ 386 #define _BCM_POLICER_MAX_ATTR_VALUE_BITS 180 387 #define _BCM_POLICER_BIT_ARRAY_SIZE _SHR_BITDCLSIZE(_BCM_POLICER_MAX_ATTR_VALUE_BITS) 388 #define _BCM_POLICER_VALUE_SET(_array, _value) SHR_BITSET(_array, _value) 389 #define _BCM_POLICER_VALUE_GET(_array, _value) SHR_BITGET(_array, _value) 390 391 typedef struct bcm_policer_combine_attr_s { 392 #define _BCM_POLICER_COLOR_GREEN 0x00000001 393 #define _BCM_POLICER_COLOR_YELLOW 0x00000002 394 #define _BCM_POLICER_COLOR_RED 0x00000004 395 uint32 cng_flags; 396 397 /* set corresponding bit-position for Prio */ 398 #define _BCM_POLICER_PKT_PRI0 0 399 #define _BCM_POLICER_PKT_PRI7 7 400 #define _BCM_POLICER_PKT_PRI15 15 401 uint32 int_pri_flags; 402 403 #define _BCM_POLICER_VLAN_FORMAT_UNTAGGED 0x00000001 404 #define _BCM_POLICER_VLAN_FORMAT_INNER 0x00000002 405 #define _BCM_POLICER_VLAN_FORMAT_OUTER 0x00000004 406 #define _BCM_POLICER_VLAN_FORMAT_BOTH 0x00000008 407 uint32 vlan_format_flags; 408 409 /* set corresponding bit-position for Prio */ 410 uint32 outer_dot1p_flags; 411 uint32 inner_dot1p_flags; 412 413 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_PKT 0x00000001 414 #define _BCM_POLICER_PKT_TYPE_CONTROL_PKT 0x00000002 415 #define _BCM_POLICER_PKT_TYPE_OAM_PKT 0x00000004 416 #define _BCM_POLICER_PKT_TYPE_BFD_PKT 0x00000008 417 #define _BCM_POLICER_PKT_TYPE_BPDU_PKT 0x00000010 418 #define _BCM_POLICER_PKT_TYPE_ICNM_PKT 0x00000020 419 #define _BCM_POLICER_PKT_TYPE_PKT_IS_1588 0x00000040 420 #define _BCM_POLICER_PKT_TYPE_KNOWN_L2UC_PKT 0x00000080 421 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_L2UC_PKT 0x00000100 422 #define _BCM_POLICER_PKT_TYPE_L2BC_PKT 0x00000200 423 #define _BCM_POLICER_PKT_TYPE_KNOWN_L2MC_PKT 0x00000400 424 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_L2MC_PKT 0x00000800 425 #define _BCM_POLICER_PKT_TYPE_KNOWN_L3UC_PKT 0x00001000 426 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_L3UC_PKT 0x00002000 427 #define _BCM_POLICER_PKT_TYPE_KNOWN_IPMC_PKT 0x00004000 428 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_IPMC_PKT 0x00008000 429 #define _BCM_POLICER_PKT_TYPE_KNOWN_MPLS_L2_PKT 0x00010000 430 #define _BCM_POLICER_PKT_TYPE_KNOWN_MPLS_L3_PKT 0x00020000 431 #define _BCM_POLICER_PKT_TYPE_KNOWN_MPLS_PKT 0x00040000 432 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_MPLS_PKT 0x00080000 433 #define _BCM_POLICER_PKT_TYPE_KNOWN_MPLS_MULTICAST_PKT 0x00100000 434 #define _BCM_POLICER_PKT_TYPE_KNOWN_MIM_PKT 0x00200000 435 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_MIM_PKT 0x00400000 436 #define _BCM_POLICER_PKT_TYPE_KNOWN_TRILL_PKT 0x00800000 437 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_TRILL_PKT 0x01000000 438 #define _BCM_POLICER_PKT_TYPE_KNOWN_NIV_PKT 0x02000000 439 #define _BCM_POLICER_PKT_TYPE_UNKNOWN_NIV_PKT 0x04000000 440 uint32 pkt_resolution_flags; 441 442 #define _BCM_POLICER_DROP_ENABLE 0x00000001 443 #define _BCM_POLICER_DROP_DISABLE 0x00000002 444 uint32 drop_flags; 445 446 #define _BCM_POLICER_IP_PKT_ENABLE 0x00000001 447 #define _BCM_POLICER_IP_PKT_DISABLE 0x00000002 448 uint32 ip_pkt_flags ; 449 450 #define _BCM_POLICER_PREMMPTABLE_PKT_ENABLE 0x00000001 451 #define _BCM_POLICER_PREMMPTABLE_PKT_DISABLE 0x00000002 452 uint32 preemptable_pkt_flags; 453 454 uint32 ethertype_flags; 455 /* Array to store values for type which have values associated with */ 456 SHR_BITDCL value_array[_bcmPolicerAttrMax][_BCM_POLICER_BIT_ARRAY_SIZE]; 457 } bcm_policer_combine_attr_t; 458 459 /* Structure to store which attributes are used by user (for complete list) */ 460 typedef struct bcm_policer_attr_selectors_s { 461 uint32 cng; 462 uint32 combine_cng_flags; 463 uint32 int_pri; 464 uint32 combine_int_pri_flags; 465 uint32 vlan_format; 466 uint32 combine_vlan_format_flags; 467 uint32 outer_dot1p; 468 uint32 combine_outer_dot1p_flags; 469 uint32 inner_dot1p; 470 uint32 combine_inner_dot1p_flags; 471 uint32 port; 472 uint32 tos_dscp; 473 uint32 tos_ecn; 474 uint32 pkt_resolution; 475 uint32 combine_pkt_res_flags; 476 uint32 svp_type; 477 uint32 drop; 478 uint32 combine_drop_flags; 479 uint32 ip_pkt; 480 uint32 preemptable_pkt; 481 uint32 ethertype; 482 uint32 combine_ip_pkt_flags; 483 uint32 total_policers; 484 uint32 total_selectors; 485 SHR_BITDCL combine_value_array[_bcmPolicerAttrMax][_BCM_POLICER_BIT_ARRAY_SIZE]; 486 bcm_policer_combine_attr_t *combine_attr_data; 487 } bcm_policer_attr_selectors_t; 488 489 /* Number of compression attribute maps. */ 490 #define _BCM_POLICER_PKT_COMPRESSED_ATTR_MAPS 5 491 492 /* Structure for global compression attribute table status. */ 493 typedef struct _bcm_policer_pkt_compressed_attr_maps_s { 494 uint8 ref_counts[_BCM_POLICER_PKT_COMPRESSED_ATTR_MAPS]; 495 uint32 cng; 496 uint32 combine_cng_flags; 497 uint32 int_pri; 498 uint32 combine_int_pri_flags; 499 uint32 vlan_format; 500 uint32 combine_vlan_format_flags; 501 uint32 outer_dot1p; 502 uint32 combine_outer_dot1p_flags; 503 uint32 inner_dot1p; 504 uint32 combine_inner_dot1p_flags; 505 uint32 port; 506 uint32 tos_dscp; 507 uint32 tos_ecn; 508 uint32 pkt_resolution; 509 uint32 combine_pkt_res_flags; 510 uint32 svp_type; 511 uint32 drop; 512 uint32 combine_drop_flags; 513 uint32 ip_pkt; 514 uint32 combine_ip_pkt_flags; 515 SHR_BITDCL combine_value_array[_bcmPolicerAttrMax][_BCM_POLICER_BIT_ARRAY_SIZE]; 516 } _bcm_policer_pkt_compressed_attr_maps_t; 517 518 typedef struct bcm_policer_svc_meter_udf_sub_div_s { 519 int udf_id; 520 uint32 offset; 521 uint32 width; 522 } bcm_policer_udf_sub_div_t; 523 524 typedef struct bcm_policer_svc_meter_udf_pkt_combine_attr_t { 525 uint8 drop_flags; 526 bcm_policer_udf_sub_div_t udf_subdiv[BCM_POLICER_SVC_METER_MAX_OFFSET]; 527 uint32 attr_value[BCM_POLICER_SVC_METER_MAX_OFFSET]; 528 uint8 selectors; 529 } bcm_policer_udf_pkt_combine_attr_t; 530 531 typedef struct bcm_policer_svc_meter_udf_attr_selectors_s { 532 uint8 drop; 533 bcm_policer_udf_sub_div_t udf_subdiv[SVC_METER_UDF_MAX_SUB_DIVISIONS]; 534 int total_subdiv; 535 uint8 udf_bits[SVC_METER_UDF1_MAX_BIT_POSITION]; 536 bcm_policer_udf_pkt_combine_attr_t *combine_attr_data; 537 } bcm_policer_udf_attr_selectors_t; 538 539 typedef struct bcm_policer_svc_meter_compressed_attr_selectors_s { 540 pkt_attr_bits_t pkt_attr_bits_v; 541 compressed_pri_cnf_attr_map_t 542 compressed_pri_cnf_attr_map_v[BCM_SVC_METER_MAP_SIZE_64]; 543 compressed_pkt_pri_attr_map_t 544 compressed_pkt_pri_attr_map_v[BCM_SVC_METER_MAP_SIZE_256]; 545 compressed_port_attr_map_t 546 compressed_port_attr_map_v[BCM_SVC_METER_PORT_MAP_SIZE]; 547 compressed_tos_attr_map_t 548 compressed_tos_attr_map_v[BCM_SVC_METER_MAP_SIZE_256]; 549 compressed_pkt_res_attr_map_t 550 compressed_pkt_res_attr_map_v[BCM_SVC_METER_MAP_SIZE_1024]; 551 offset_table_entry_t offset_map[BCM_SVC_METER_MAP_SIZE_256]; 552 } compressed_attr_selectors_t; 553 554 typedef struct bcm_policer_svc_meter_udf_pkt_attr_selectors_s { 555 udf_pkt_attr_bits_t udf_pkt_attr_bits_v; 556 uint32 drop; 557 bcm_policer_udf_sub_div_t udf_subdiv[SVC_METER_UDF_MAX_SUB_DIVISIONS]; 558 uint32 total_subdiv; 559 uint32 num_selectors; 560 int udf_id; 561 offset_table_entry_t offset_map[BCM_SVC_METER_MAP_SIZE_256]; 562 } udf_pkt_attr_selectors_t; 563 564 typedef struct bcm_policer_svc_meter_attr_s { 565 bcm_policer_svc_meter_mode_type_t mode_type_v; 566 /* Valid only for uncompressed */ 567 uncompressed_attr_selectors_t uncompressed_attr_selectors_v; 568 /* valid only for compressed */ 569 compressed_attr_selectors_t compressed_attr_selectors_v; 570 /* valid only for udf */ 571 udf_pkt_attr_selectors_t udf_pkt_attr_selectors_v; 572 } bcm_policer_svc_meter_attr_t; 573 574 /* Policer Flow types 575 * A category is needed to know that the policers allocated 576 * in the group are micro/macro/other policers */ 577 typedef enum _bcm_policer_flow_type_e { 578 bcmPolicerFlowTypeNormal = 0, /* meter is other than MACRO or MICRO */ 579 bcmPolicerFlowTypeMicro = 1, /* meter is MICRO */ 580 bcmPolicerFlowTypeMacro = 2 /* meter is MACRO */ 581 } _bcm_policer_flow_type_t; 582 583 typedef struct _bcm_policer_flow_info_s { 584 int mode_id; 585 _bcm_policer_flow_type_t flow_type; 586 int req_alloc; 587 int skip_pool; 588 int skip_bank; 589 int req_pool; 590 int req_base_offset; 591 } _bcm_policer_flow_info_t; 592 593 /* Below data structure is used for KT2/TR3/FB4 */ 594 typedef struct bcm_policer_group_mode_attr_selector_wb_s { 595 uint32 flags; /* packet attribute selector flags */ 596 uint32 policer_offset; /* Policer Offset */ 597 bcm_policer_group_mode_attr_t attr; /* Attribute Selector */ 598 uint32 attr_value; /* Attribute Values */ 599 int udf_id; /* UDF ID created using bcm_udf_create. 600 Applicable only if Group mode 601 attribute is 602 bcmPolicerGroupModeAttrUdf. */ 603 uint32 offset; /* Offset in bits from the beginning of 604 the packet attribute */ 605 uint32 width; /* Number of bits in packet attribute 606 from offset to be used for policer 607 offset mapping */ 608 } bcm_policer_group_mode_attr_selector_wb_t; 609 610 #ifdef BCM_WARM_BOOT_SUPPORT 611 /* 612 * Below data structure is used to sync/recover data to/from scache. So, 613 * no new fields can be added to this structure directly. 614 * bcm_policer_group_mode_attr_selector_wb_t is used for KT2/TR3/FB4. 615 */ 616 typedef struct bcm_policer_svc_meter_group_mode_attr_selectors_info_s { 617 uint32 flags; 618 uint32 num_selectors; 619 bcm_policer_group_mode_attr_selector_wb_t 620 attr_selectors[BCM_POLICER_SVC_METER_MAX_ATTR_SELECTORS]; 621 } bcm_policer_group_mode_attr_selectors_info_t; 622 #endif /* BCM_WARM_BOOT_SUPPORT */ 623 624 /* Create a svc meter mode entry. */ 625 extern int _bcm_policer_svc_meter_create_mode( 626 int unit, 627 bcm_policer_svc_meter_attr_t meter_attr, 628 bcm_policer_svc_meter_mode_t *bcm_policer_svc_meter_mode_v); 629 630 /* Delete a svc meter mode entry. */ 631 extern int _bcm_policer_svc_meter_delete_mode( 632 int unit, 633 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v); 634 635 636 typedef struct bcm_policer_svc_meter_bookkeep_mode_s { 637 uint32 used; 638 uint32 reference_count; 639 bcm_policer_svc_meter_attr_t meter_attr; 640 uint32 no_of_policers; 641 bcm_policer_group_mode_t group_mode; 642 int8 type; 643 uint32 no_of_selectors; 644 bcm_policer_group_mode_attr_selector_wb_t *attr_selectors; 645 } bcm_policer_svc_meter_bookkeep_mode_t; 646 647 typedef struct _bcm_policer_pkt_attr_bit_pos_s { 648 int start_bit; 649 int end_bit; 650 } _bcm_policer_pkt_attr_bit_pos_t; 651 652 typedef enum _bcm_policer_svm_source_type_s { 653 _BCM_SVM_MEM_PORT = 0, 654 _BCM_SVM_MEM_VLAN = 1, 655 _BCM_SVM_MEM_VFI = 2, 656 _BCM_SVM_MEM_SOURCE_VP = 3, 657 _BCM_SVM_MEM_VLAN_XLATE = 4, 658 _BCM_SVM_MEM_VFP_POLICY_TABLE = 5, 659 _BCM_SVM_MEM_COUNT 660 } _bcm_policer_svm_source_type_t; 661 662 typedef struct { 663 soc_mem_t table; 664 soc_field_t offset_mode; 665 soc_field_t meter_index; 666 } _bcm_policer_svm_source_t; 667 668 /* Structure contains parameters which varies among different devices */ 669 typedef struct _bcm_policer_svm_dev_attr_s { 670 uint8 banks_per_pool; 671 uint8 uncompressed_ing_port_size; 672 uint8 uncompressed_svp_type_size; 673 uint8 compressed_int_pri_bit_pos; 674 uint8 *pkt_resolution; 675 _bcm_policer_pkt_attr_bit_pos_t *uncompressed_pkt_attr_bit_pos; 676 _bcm_policer_pkt_attr_bit_pos_t *compressed_pkt_attr_bit_pos; 677 _bcm_policer_pkt_attr_bit_pos_t *compressed_attr_map_bit_pos; 678 } _bcm_policer_svm_dev_attr_t; 679 680 typedef struct _bcm_policer_global_meter_control_s { 681 _bcm_policer_svm_dev_attr_t svm_dev_attr_info; 682 _bcm_policer_svm_source_t svm_source[_BCM_SVM_MEM_COUNT]; 683 } _bcm_policer_global_meter_control_t; 684 685 bcm_error_t _bcm_policer_svm_source_index_get( 686 int unit, 687 soc_mem_t table, 688 _bcm_policer_svm_source_type_t *mem_index 689 ); 690 691 bcm_error_t _bcm_policer_svc_meter_get_available_mode( uint32 unit, 692 bcm_policer_svc_meter_mode_t *svc_meter_mode 693 ); 694 695 bcm_error_t _bcm_policer_svc_meter_update_selector_keys_enable_fields( 696 int unit, 697 soc_reg_t bcm_policer_svc_meter_pkt_attr_selector_key_reg, 698 uint64 *bcm_policer_svc_meter_pkt_attr_selector_key_reg_value, 699 uint32 bcm_policer_svc_meter_pkt_attr_bit_position, 700 uint32 bcm_policer_svc_meter_pkt_attr_total_bits, 701 uint8 bcm_policer_svc_meter_pkt_attr_bit_mask, 702 uint8 *bcm_policer_svc_meter_current_bit_selector_position 703 ); 704 705 bcm_error_t _bcm_policer_svc_meter_update_offset_table( 706 int unit, 707 soc_mem_t bcm_policer_svc_meter_offset_table_mem, 708 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v, 709 offset_table_entry_t *offset_map 710 ); 711 712 bcm_error_t _bcm_policer_svc_meter_reserve_mode( 713 uint32 unit, 714 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v, 715 bcm_policer_group_mode_t group_mode, 716 bcm_policer_svc_meter_attr_t *meter_attr 717 ); 718 719 bcm_error_t _bcm_policer_svc_meter_unreserve_mode( 720 uint32 unit, 721 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v 722 ); 723 724 bcm_error_t bcm_policer_svc_meter_inc_mode_reference_count( 725 uint32 unit, 726 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v 727 ); 728 729 bcm_error_t bcm_policer_svc_meter_dec_mode_reference_count( 730 uint32 unit, 731 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v 732 ); 733 734 bcm_error_t _bcm_policer_svc_meter_update_udf_selector_keys( 735 int unit, 736 soc_reg_t bcm_policer_svc_meter_pkt_attr_selector_key_reg, 737 udf_pkt_attr_selectors_t *udf_pkt_attr_selectors_v, 738 uint32 *total_udf_bits 739 ); 740 741 742 bcm_error_t _bcm_policer_svc_meter_get_mode_info( 743 int unit, 744 bcm_policer_svc_meter_mode_t meter_mode_v, 745 bcm_policer_svc_meter_bookkeep_mode_t *mode_info 746 ); 747 748 /* policer API's */ 749 750 typedef struct bcm_policer_global_meter_action_bookkeep_s { 751 uint32 used; 752 uint32 reference_count; 753 } bcm_policer_global_meter_action_bookkeep_t; 754 755 typedef struct bcm_policer_global_meter_init_staus_s { 756 uint32 initialised; 757 } bcm_policer_global_meter_init_status_t; 758 759 int bcm_esw_global_meter_init(int unit); 760 int _bcm_esw_global_meter_reinit(int unit); 761 762 int _bcm_esw_global_meter_offset_mode_reinit(int unit); 763 int _bcm_esw_global_meter_compressed_offset_mode_reinit( 764 int unit, 765 int mode, 766 uint32 selector_count, 767 uint32 selector_for_bit_x_en_field_value[8], 768 uint32 selector_for_bit_x_field_value[8]); 769 int _bcm_esw_global_meter_uncompressed_offset_mode_reinit( 770 int unit, 771 int mode, 772 uint32 selector_count, 773 uint32 selector_for_bit_x_en_field_value[8], 774 uint32 selector_for_bit_x_field_value[8]); 775 int _bcm_esw_global_meter_udf_offset_mode_reinit( 776 int unit, 777 int mode, 778 uint32 selector_count, 779 uint32 selector_for_bit_x_en_field_value[8], 780 uint32 selector_for_bit_x_field_value[8]); 781 782 int _bcm_esw_global_meter_action_reinit(int unit); 783 int _bcm_esw_is_global_policer( 784 int unit, 785 bcm_policer_t policer, 786 int *is_global_policer); 787 int _bcm_esw_policer_validate(int unit, bcm_policer_t *policer); 788 int _bcm_esw_policer_decrement_ref_count(int unit, bcm_policer_t policer); 789 int _bcm_esw_policer_increment_ref_count(int unit, bcm_policer_t policer); 790 int _bcm_esw_global_meter_cleanup(int unit); 791 int _bcm_esw_add_policer_to_table(int unit,bcm_policer_t policer, 792 int table, int index, void *data); 793 int _bcm_esw_delete_policer_from_table(int unit,bcm_policer_t policer, 794 soc_mem_t table, int index, void *data); 795 int _bcm_esw_get_policer_from_table(int unit,soc_mem_t table,int index, 796 void *data, 797 bcm_policer_t *policer, int skip_read); 798 int _bcm_esw_policer_offset_mode_get( 799 int unit, 800 bcm_policer_t policer_id, 801 int *offset_mode); 802 803 804 #define MAX_POLICER_OFFSETS 8 805 /* 806 * Typedef: 807 * _global_meter_policer_t 808 * Purpose: 809 * This is the policer description structure. 810 * Indexed by bcm_policer_t handle. 811 */ 812 typedef struct _global_meter_policer_s { 813 bcm_policer_t pid; /* Unique policer identifier. */ 814 uint16 ref_count;/* SW object use reference count. */ 815 uint32 action_id; /* Index to action table */ 816 uint32 direction; 817 uint32 no_of_policers; 818 uint8 offset[MAX_POLICER_OFFSETS]; 819 bcm_policer_group_mode_t grp_mode; 820 struct _global_meter_policer_s *next; /* Policer lookup linked list */ 821 }_global_meter_policer_control_t; 822 823 /* 824 * Typedef: 825 * _global_meter_horizontal_alloc_t 826 * Purpose: 827 * This is the policer description structure. 828 * Indexed by bcm_policer_t handle. 829 */ 830 typedef struct _global_meter_horizontal_alloc_s { 831 uint8 alloc_bit_map;/*Meter allocation bit map across pools for an index */ 832 uint8 no_of_groups_allocated;/* SW object use reference count. */ 833 uint8 first_bit_to_use; /* first bit position from where new 834 block can be allocated */ 835 uint8 last_bit_to_use; /* last pool till which 836 block can be allocated */ 837 }_global_meter_horizontal_alloc_t; 838 839 #if defined(BCM_GLOBAL_METER_V2_SUPPORT) 840 /* 841 * Global Meter's platform specific information per service 842 * This structure maintains chip specific information 843 */ 844 typedef struct bcmi_global_meter_dev_info_s { 845 char *table_name; 846 int (*action_supported)( 847 int unit, 848 bcm_policer_action_t action); 849 int (*group_mode_supported)( 850 int unit, 851 bcm_policer_group_mode_t group_mode); 852 int (*group_mode_type_supported)( 853 int unit, 854 bcm_policer_group_mode_type_t group_mode_type); 855 int (*group_mode_attr_supported)( 856 int unit, 857 bcm_policer_group_mode_attr_t group_mode_attr); 858 int (*group_mode_attr_validate)( 859 int unit, 860 bcm_policer_group_mode_attr_t group_mode_attr, 861 uint32 value); 862 int (*mem_clear)( 863 int unit); 864 int (*mem_range_clear)( 865 int unit, 866 int base_index, 867 uint32 numbers); 868 int (*ifg_set)( 869 int unit, 870 uint8 ifg_enable); 871 int (*ifg_get)( 872 int unit, 873 uint8 *ifg_enable); 874 int (*source_order_set)( 875 int unit, 876 bcm_policer_global_meter_source_t *source_order, 877 uint32 source_order_count); 878 int (*source_order_get)( 879 int unit, 880 uint32 source_order_count, 881 bcm_policer_global_meter_source_t *source_order); 882 int (*svm_enable_set)( 883 int unit, 884 uint8 enable); 885 int (*svm_enable_get)( 886 int unit, 887 uint8 *enabled); 888 int (*seop_enable_set)( 889 int unit, 890 uint8 enable); 891 int (*seop_enable_get)( 892 int unit, 893 uint8 *enabled); 894 int (*tcam_keys_set)( 895 int unit, 896 pkt_tcam_attr_bits_t *pkt_attr_bits_v); 897 int (*tcam_keys_get)( 898 int unit, 899 pkt_tcam_attr_bits_t *pkt_attr_bits_v); 900 int (*tcam_keys_delete)( 901 int unit, 902 uint32 sw_idx); 903 int (*policer_to_table_set)( 904 int unit, 905 soc_mem_t mem, 906 uint32 mem_index, 907 void *mem_data, 908 int meter_index, 909 int meter_offset_mode, 910 int skip_read); 911 int (*policer_to_table_get)( 912 int unit, 913 soc_mem_t mem, 914 uint32 mem_index, 915 void *mem_data, 916 int *meter_index, 917 int *meter_offset_mode, 918 int skip_read); 919 int (*meter_table_bitsize_get)( 920 int unit, 921 uint32 sw_idx, 922 uint32 *refresh_bitsize, 923 uint32 *bucket_max_bitsize, 924 uint32 *bucket_cnt_bitsize); 925 int (*meter_table_set)( 926 int unit, 927 uint32 sw_idx, 928 bcm_policer_mode_t meter_mode, 929 uint32 meter_flags, 930 uint32 average_pkt_size, 931 uint32 meter_gran_mode, 932 uint32 bucket_size, 933 uint32 bucket_count, 934 uint32 refresh_rate, 935 uint32 granularity); 936 int (*meter_table_get)( 937 int unit, 938 uint32 sw_idx, 939 uint32 *bucket_size, 940 uint32 *bucket_count, 941 uint32 *refresh_rate, 942 uint32 *granularity, 943 uint32 *pkt_bytes, 944 uint32 *tsn_modified, 945 uint32 *meter_gran_mode, 946 uint32 *average_pkt_size); 947 int (*policy_mode_set)( 948 int unit, 949 uint32 sw_idx, 950 bcm_policer_mode_t meter_mode, 951 uint32 meter_flags); 952 int (*policy_mode_get)( 953 int unit, 954 uint32 sw_idx, 955 bcm_policer_mode_t *meter_mode, 956 uint32 *meter_flags); 957 int (*policy_action_param_configure)( 958 int unit, 959 bcm_policer_action_t action, 960 uint32 param0, 961 uint64 *green_action, 962 uint64 *yellow_action, 963 uint64 *red_action); 964 int (*policy_action_set)( 965 int unit, 966 uint32 sw_idx, 967 uint64 green_action, 968 uint64 yellow_action, 969 uint64 red_action); 970 int (*policy_action_get)( 971 int unit, 972 uint32 sw_idx, 973 uint64 *green_action, 974 uint64 *yellow_action, 975 uint64 *red_action); 976 } bcmi_global_meter_dev_info_t; 977 #endif /* BCM_GLOBAL_METER_V2_SUPPORT */ 978 979 int _bcm_global_meter_policer_get(int unit, bcm_policer_t pid, 980 _global_meter_policer_control_t **policer_p); 981 982 983 int _bcm_gloabl_meter_reserve_bloc_horizontally(int unit, int pool_id, 984 bcm_policer_t pid); 985 int _bcm_gloabl_meter_unreserve_bloc_horizontally(int unit, int pool_id, 986 bcm_policer_t pid); 987 int _bcm_global_meter_reserve_bloc_horizontally(int unit, int pool_id, 988 bcm_policer_t pid); 989 990 int _bcm_esw_global_meter_policer_sync(int unit); 991 int _bcm_esw_global_meter_policer_get(int unit, bcm_policer_t policer_id, 992 bcm_policer_config_t *pol_cfg); 993 int _bcm_esw_global_meter_policer_destroy(int unit, bcm_policer_t policer_id); 994 int _bcm_esw_global_meter_policer_destroy_all(int unit); 995 int _bcm_esw_global_meter_policer_destroy2(int unit, 996 _global_meter_policer_control_t *policer_control); 997 int _bcm_esw_global_meter_policer_set(int unit, bcm_policer_t policer_id, 998 bcm_policer_config_t *pol_cfg); 999 int _bcm_esw_global_meter_policer_traverse(int unit, 1000 bcm_policer_traverse_cb cb, void *user_data); 1001 1002 int _bcm_esw_policer_svc_meter_delete_mode( int unit, 1003 bcm_policer_svc_meter_mode_t bcm_policer_svc_meter_mode_v); 1004 int _bcm_global_meter_get_coupled_cascade_policer_index(int unit, 1005 bcm_policer_t policer_id, 1006 _global_meter_policer_control_t *policer_control, 1007 int *new_index); 1008 int _bcm_global_meter_base_policer_get(int unit, bcm_policer_t pid, 1009 _global_meter_policer_control_t **policer_p); 1010 int _bcm_esw_get_policer_id_from_index_offset(int unit, int index, 1011 int offset_mode, 1012 bcm_policer_t *policer_id); 1013 int _bcm_esw_reset_policer_from_table(int unit, bcm_policer_t policer, 1014 int table, int index, void *data); 1015 int _bcm_esw_policer_group_create(int unit, bcm_policer_group_mode_t mode, 1016 _bcm_policer_flow_info_t *flow_info, 1017 bcm_policer_map_t *offset_map, 1018 bcm_policer_t *policer_id, int *npolicers); 1019 int _bcm_esw_get_policer_table_index(int unit, bcm_policer_t policer, 1020 int *index); 1021 int _check_global_meter_init(int unit); 1022 #endif /* !_BCM_INT_SVC_METER_H */