ft_class.h (3717B)
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 * File: ft_class.h 8 * Purpose: Function declarations for flowtracker class. 9 */ 10 11 #ifndef _BCM_INT_FT_CLASS_H_ 12 #define _BCM_INT_FT_CLASS_H_ 13 14 #include <soc/defs.h> 15 #include <sal/core/libc.h> 16 #include <shared/bsl.h> 17 #include <bcm_int/esw/flowtracker/ft_group.h> 18 19 #if defined(BCM_FLOWTRACKER_V2_SUPPORT) 20 extern int 21 bcmi_ftv2_egr_class_source_set( 22 int unit, 23 uint32 options, 24 bcm_flowtracker_class_source_type_t source_type); 25 26 extern int 27 bcmi_ftv2_egr_class_source_get( 28 int unit, 29 uint32 options, 30 bcm_flowtracker_class_source_type_t *source_type); 31 32 extern void 33 bcmi_ftv2_class_show(int unit); 34 35 #endif /* BCM_FLOWTRACKER_V2_SUPPORT */ 36 37 #if defined(BCM_FLOWTRACKER_V3_SUPPORT) 38 39 typedef struct bcmi_ft_agg_class_source_type_map_s { 40 uint32 amft_hw_val; 41 42 uint32 aeft_hw_val; 43 } bcmi_ft_agg_class_source_type_map_t; 44 45 typedef struct bcmi_ft_aggregate_class_state_s { 46 /* Number of entries */ 47 int num_entries; 48 49 /* Bitmap for class ids */ 50 SHR_BITDCL *bitmap[BCMI_FT_GROUP_TYPE_COUNT]; 51 52 /* Reference count per class Id */ 53 int *ref_count_array; 54 55 /* Class Source type mapping */ 56 bcmi_ft_agg_class_source_type_map_t *map; 57 58 } bcmi_ft_aggregate_class_state_t; 59 60 61 extern bcmi_ft_aggregate_class_state_t 62 bcmi_ft_aggregate_class_state[BCM_MAX_NUM_UNITS]; 63 64 #define BCMI_FT_AGG_CLASS_MAX_IDX(_unit_) \ 65 bcmi_ft_aggregate_class_state[(_unit_)].num_entries 66 67 #define BCMI_FT_AGG_CLASS_BITMAP(_unit_, _group_type_) \ 68 bcmi_ft_aggregate_class_state[(_unit_)].bitmap[(_group_type_)] 69 70 #define BCMI_FT_AGG_CLASS_REF(_unit_) \ 71 bcmi_ft_aggregate_class_state[(_unit_)].ref_count_array 72 73 #define BCMI_FT_AGG_CLASS_REF_COUNT(_unit_, _idx_) \ 74 bcmi_ft_aggregate_class_state[(_unit_)].ref_count_array[(_idx_)] 75 76 #define BCMI_FT_AGG_CLASS_ST_MAP(_unit_) \ 77 bcmi_ft_aggregate_class_state[(_unit_)].map 78 79 #define BCMI_FT_AGG_CLASS_ST_MAP_HW_VAL(_unit_, _source_type_, aft) \ 80 (bcmi_ft_aggregate_class_state[(_unit_)].map)[(_source_type_)].aft ##_hw_val 81 82 #define BCMI_FT_AGG_CLASS_ID_MIN 1 83 #define BCMI_FT_AGG_CLASS_ID_MAX 63 84 #define BCMI_FT_AGG_CLASS_ST_INVALID (-1) 85 86 extern int 87 bcmi_ftv3_aggregate_class_init( 88 int unit); 89 90 extern int 91 bcmi_ftv3_aggregate_class_cleanup( 92 int unit); 93 94 extern int 95 bcmi_ftv3_aggregate_class_create( 96 int unit, 97 uint32 options, 98 bcm_flowtracker_group_type_t group_type, 99 bcm_flowtracker_aggregate_class_info_t *aggregate_class_info, 100 uint32 *aggregate_class); 101 102 extern int 103 bcmi_ftv3_aggregate_class_get( 104 int unit, 105 uint32 aggregate_class, 106 bcm_flowtracker_group_type_t group_type, 107 bcm_flowtracker_aggregate_class_info_t *aggregate_class_info); 108 109 extern int 110 bcmi_ftv3_aggregate_class_get_all( 111 int unit, 112 bcm_flowtracker_group_type_t group_type, 113 int size, 114 uint32 *aggregate_class_array, 115 int *actual_size); 116 117 extern int 118 bcmi_ftv3_aggregate_class_destroy( 119 int unit, 120 uint32 aggregate_class, 121 bcm_flowtracker_group_type_t group_type); 122 123 extern int 124 bcmi_ftv3_aggregate_class_entry_add_check( 125 int unit, 126 uint32 aggregate_class); 127 128 extern int 129 bcmi_ftv3_aggregate_class_ref_update(int unit, 130 uint32 aggregate_class, 131 int count); 132 133 extern void 134 bcmi_ftv3_aggregate_class_show(int unit, 135 uint32 aggregate_class); 136 137 #endif /* BCM_FLOWTRACKER_V3_SUPPORT */ 138 #endif /* _BCM_INT_FT_CLASS_H_ */