ft_user.h (9204B)
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_user.h 8 * Purpose: Function declarations for flowtracker user entry management. 9 */ 10 11 #ifndef _BCM_INT_FT_USER_H_ 12 #define _BCM_INT_FT_USER_H_ 13 14 #include <soc/defs.h> 15 16 #if defined(BCM_FLOWTRACKER_SUPPORT) 17 #include <bcm_int/esw/flowtracker/ft_group.h> 18 19 #if defined(BCM_FLOWTRACKER_V3_SUPPORT) 20 #define BCMI_FTK_MAX_ENTRIES (1024) 21 22 typedef struct bcmi_ftk_user_entry_info_s { 23 bcm_flowtracker_group_t group_id; 24 int ref_count; 25 } bcmi_ftk_user_entry_info_t; 26 27 typedef struct bcmi_ftk_user_state_s { 28 bcmi_ftk_user_entry_info_t **user_entry_info[BCMI_FT_GROUP_TYPE_COUNT]; 29 int user_entry_count[BCMI_FT_GROUP_TYPE_COUNT]; 30 } bcmi_ftk_user_state_t; 31 32 33 extern bcmi_ftk_user_state_t *bcmi_ftk_user_state[BCM_MAX_NUM_UNITS]; 34 35 #define BCMI_FTK_USER_ENTRY_TYPE(_unit_, _group_type_) \ 36 (bcmi_ftk_user_state[(_unit_)]->user_entry_info[(_group_type_)]) 37 38 #define BCMI_FTK_USER_ENTRY_MAX_COUNT(_unit_, _group_type_) \ 39 (bcmi_ftk_user_state[(_unit_)]->user_entry_count[(_group_type_)]) 40 41 #define BCMI_FTK_USER_ENTRY_INFO(_unit_, _group_type_, _idx_) \ 42 (bcmi_ftk_user_state[(_unit_)]->user_entry_info[(_group_type_)][(_idx_)]) 43 44 #endif /* BCM_FLOWTRACKER_V3_SUPPORT */ 45 46 /*|*****************************************************| 47 *|*****************************************************| 48 *| START - Software Insert Methods. | 49 *|*****************************************************| 50 *|*****************************************************| 51 */ 52 53 extern int 54 bcmi_ft_user_init(int unit); 55 56 extern void 57 bcmi_ft_user_cleanup(int unit); 58 59 /* 60 * Function: 61 * bcmi_ftk_user_entry_add 62 * Purpose: 63 * Add a user flow entry basis user input key elements. API 64 * expects that all tracking parametrs of type = 'KEY' in the 65 * group are specified. 66 * Parameters: 67 * unit - (IN) Unit number. 68 * flow_group_id - (IN) Flowtracker flow group ID. 69 * options - (IN) Options for creting the flowtracker user entry. 70 * num_user_entry_params - (IN) Number of user entry params. 71 * user_entry_param_list - (IN) List of user entry params to add flow entry. 72 * entry_handle - (OUT) User entry handle corresponding to the entry added. 73 * Returns: 74 * BCM_E_xxx 75 * Notes: 76 */ 77 extern int 78 bcmi_ftk_user_entry_add( 79 int unit, 80 bcm_flowtracker_group_t flow_group_id, 81 uint32 options, 82 int num_user_entry_params, 83 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 84 bcm_flowtracker_user_entry_handle_t *entry_handle); 85 86 /* 87 * Function: 88 * bcmi_ftk_user_entry_get 89 * Purpose: 90 * Fetch user entry info given the entry handle. 91 * Parameters: 92 * unit - (IN) Unit number. 93 * entry_handle - (IN) Flowtracker user entry handle. 94 * num_user_entry_params - (IN) Number of user entry params. 95 * user_entry_param_list - (IN/OUT) List of user entry params added in the flow entry. 96 * actual_user_entry_params - (OUT) Actual number of params in the user entry. 97 * Returns: 98 * BCM_E_xxx 99 * Notes: 100 */ 101 extern int 102 bcmi_ftk_user_entry_get( 103 int unit, 104 bcm_flowtracker_user_entry_handle_t *entry_handle, 105 int num_user_entry_params, 106 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 107 int *actual_user_entry_params); 108 109 /* 110 * Function: 111 * bcmi_ftk_user_entry_get_all 112 * Purpose: 113 * Fetch all user entries added in a against a given flow group. 114 * Parameters: 115 * unit - (IN) Unit number. 116 * flow_group_id - (IN) Flowtracker flow group ID. 117 * num_user_entry_handles - (IN) Number of export elements intended in the tempate. 118 * user_entry_handle_list - (IN/OUT) List of user entry handles corresponding to the user entries added. 119 * actual_user_entry_handles - (OUT) Actual number of user entry handles corresponding to the entries added. 120 * Returns: 121 * BCM_E_xxx 122 * Notes: 123 */ 124 extern int 125 bcmi_ftk_user_entry_get_all( 126 int unit, 127 bcm_flowtracker_group_t flow_group_id, 128 int num_user_entry_handles, 129 bcm_flowtracker_user_entry_handle_t *user_entry_handle_list, 130 int *actual_user_entry_handles); 131 132 /* 133 * Function: 134 * bcmi_ftk_user_entry_delete 135 * Purpose: 136 * Delete user flow entry that is added earlier. 137 * Parameters: 138 * unit - (IN) Unit number. 139 * flow_group_id - (IN) Flowtracker flow group ID. 140 * entry_handle - (IN) User entry handle corresponding to the entry added. 141 * Returns: 142 * BCM_E_xxx 143 * Notes: 144 */ 145 extern int 146 bcmi_ftk_user_entry_delete( 147 int unit, 148 bcm_flowtracker_group_t flow_group_id, 149 bcm_flowtracker_user_entry_handle_t *entry_handle); 150 151 /* 152 * Function: 153 * bcmi_ftk_user_entry_delete_all 154 * Purpose: 155 * Delete user flow entry that is added earlier. 156 * Parameters: 157 * unit - (IN) Unit number. 158 * flow_group_id - (IN) Flowtracker flow group ID. 159 * Returns: 160 * BCM_E_xxx 161 * Notes: 162 */ 163 extern int 164 bcmi_ftk_user_entry_delete_all( 165 int unit, 166 bcm_flowtracker_group_t flow_group_id); 167 168 /*|*****************************************************| 169 *|*****************************************************| 170 *| END - Software Insert Methods. | 171 *|*****************************************************| 172 *|*****************************************************| 173 */ 174 175 #endif /* BCM_FLOWTRACKER_SUPPORT */ 176 177 #if defined(BCM_FLOWTRACKER_V3_SUPPORT) 178 /* 179 * Function: 180 * bcmi_ftv3_aggregate_user_entry_add 181 * Purpose: 182 * Add a aggregate user flow entry basis user input key elements. 183 * Parameters: 184 * unit - (IN) Unit number. 185 * flow_group_id - (IN) Flowtracker flow group ID. 186 * options - (IN) Options for creting the flowtracker user entry. 187 * num_user_entry_params - (IN) Number of user entry params. 188 * user_entry_param_list - (IN) List of user entry params to add flow entry. 189 * entry_handle - (OUT) User entry handle corresponding to the entry added. 190 * Returns: 191 * BCM_E_xxx 192 * Notes: 193 */ 194 extern int 195 bcmi_ftv3_aggregate_user_entry_add( 196 int unit, 197 bcm_flowtracker_group_t flow_group_id, 198 uint32 options, 199 int num_user_entry_params, 200 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 201 bcm_flowtracker_user_entry_handle_t *entry_handle); 202 203 /* 204 * Function: 205 * bcmi_ftv3_aggregate_user_entry_get 206 * Purpose: 207 * Fetch aggregate user entry info given the entry handle. 208 * Parameters: 209 * unit - (IN) Unit number. 210 * entry_handle - (IN) Flowtracker user entry handle. 211 * num_user_entry_params - (IN) Number of user entry params. 212 * user_entry_param_list - (IN/OUT) List of user entry params added in the flow entry. 213 * actual_user_entry_params - (OUT) Actual number of params in the user entry. 214 * Returns: 215 * BCM_E_xxx 216 * Notes: 217 */ 218 extern int 219 bcmi_ftv3_aggregate_user_entry_get( 220 int unit, 221 bcm_flowtracker_user_entry_handle_t *entry_handle, 222 int num_user_entry_params, 223 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 224 int *actual_user_entry_params); 225 226 /* 227 * Function: 228 * bcmi_ftv3_aggregate_user_entry_get_all 229 * Purpose: 230 * Fetch all aggregate user entries added in a against a given flow group. 231 * Parameters: 232 * unit - (IN) Unit number. 233 * flow_group_id - (IN) Flowtracker flow group ID. 234 * num_user_entry_handles - (IN) Number of export elements intended in the tempate. 235 * user_entry_handle_list - (IN/OUT) List of user entry handles corresponding to the user entries added. 236 * actual_user_entry_handles - (OUT) Actual number of user entry handles corresponding to the entries added. 237 * Returns: 238 * BCM_E_xxx 239 * Notes: 240 */ 241 extern int 242 bcmi_ftv3_aggregate_user_entry_get_all( 243 int unit, 244 bcm_flowtracker_group_t flow_group_id, 245 int num_user_entry_handles, 246 bcm_flowtracker_user_entry_handle_t *user_entry_handle_list, 247 int *actual_user_entry_handles); 248 249 /* 250 * Function: 251 * bcmi_ftv3_aggregate_user_entry_delete 252 * Purpose: 253 * Delete aggregate user flow entry that is added earlier. 254 * Parameters: 255 * unit - (IN) Unit number. 256 * flow_group_id - (IN) Flowtracker flow group ID. 257 * entry_handle - (IN) User entry handle corresponding to the entry added. 258 * Returns: 259 * BCM_E_xxx 260 * Notes: 261 */ 262 extern int 263 bcmi_ftv3_aggregate_user_entry_delete( 264 int unit, 265 bcm_flowtracker_group_t flow_group_id, 266 bcm_flowtracker_user_entry_handle_t *entry_handle); 267 268 extern int 269 bcmi_ftv3_user_entry_entry_add_check( 270 int unit, 271 bcm_flowtracker_group_type_t group_type, 272 bcm_flowtracker_group_t id, 273 int flow_index); 274 275 extern int 276 bcmi_ftv3_user_entry_ref_update( 277 int unit, 278 bcm_flowtracker_group_type_t group_type, 279 int flow_index, 280 int count); 281 282 #endif /* BCM_FLOWTRACKE_V3_SUPPORT */ 283 284 #ifdef BCM_WARM_BOOT_SUPPORT 285 286 extern int 287 bcmi_ft_user_warmboot_alloc(int unit, soc_scache_handle_t scache_handle); 288 289 extern int 290 bcmi_ft_user_warmboot_sync(int unit, soc_scache_handle_t scache_handle); 291 292 extern int 293 bcmi_ft_user_warmboot_recover(int unit, soc_scache_handle_t scache_handle); 294 295 #endif /* BCM_WARM_BOOT_SUPPORT */ 296 297 #endif /* _BCM_INT_FT_USER_H_ */