ipfix.h (3971B)
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 8 #ifndef _BCM_INT_IPFIX_H 9 #define _BCM_INT_IPFIX_H 10 11 #include <bcm/types.h> 12 #include <soc/profile_mem.h> 13 14 #define _BCM_IPFIX_CB_MAX 3 15 16 /* Index into array of profile structures */ 17 typedef enum _bcm_ipfix_profile_id_e { 18 _BCM_IPFIX_PROFILE_ID_INVALID = -1, 19 _BCM_IPFIX_PROFILE_ID_ING_DSCP_XLATE_TABLE = 0, 20 _BCM_IPFIX_PROFILE_ID_ING_IPV4_MASK_SET_A, 21 _BCM_IPFIX_PROFILE_ID_ING_IPV4_MASK_SET_B, 22 _BCM_IPFIX_PROFILE_ID_ING_IPV6_MASK_SET_A, 23 _BCM_IPFIX_PROFILE_ID_ING_IPV6_MASK_SET_B, 24 _BCM_IPFIX_PROFILE_ID_EGR_DSCP_XLATE_TABLE, 25 _BCM_IPFIX_PROFILE_ID_EGR_IPV4_MASK_SET_A, 26 _BCM_IPFIX_PROFILE_ID_EGR_IPV6_MASK_SET_A, 27 _BCM_IPFIX_PROFILE_ID_ING_PORT_RECORD_LIMIT_SET, 28 _BCM_IPFIX_PROFILE_ID_ING_MAXIMUM_LIVE_TIME_SET, 29 _BCM_IPFIX_PROFILE_ID_ING_MINIMUM_LIVE_TIME_SET, 30 _BCM_IPFIX_PROFILE_ID_ING_MAXIMUM_IDLE_AGE_SET, 31 _BCM_IPFIX_PROFILE_ID_ING_SAMPLING_LIMIT_SET, 32 _BCM_IPFIX_PROFILE_ID_EGR_PORT_RECORD_LIMIT_SET, 33 _BCM_IPFIX_PROFILE_ID_EGR_MAXIMUM_LIVE_TIME_SET, 34 _BCM_IPFIX_PROFILE_ID_EGR_MINIMUM_LIVE_TIME_SET, 35 _BCM_IPFIX_PROFILE_ID_EGR_MAXIMUM_IDLE_AGE_SET, 36 _BCM_IPFIX_PROFILE_ID_EGR_SAMPLING_LIMIT_SET, 37 _BCM_IPFIX_PROFILE_ID_COUNT 38 } _bcm_ipfix_profile_id_t; 39 40 typedef enum _bcm_ipfix_profile_type_e { 41 _BCM_IPFIX_PROFILE_TYPE_NONE = 0, 42 _BCM_IPFIX_PROFILE_TYPE_REG, 43 _BCM_IPFIX_PROFILE_TYPE_MEM 44 } _bcm_ipfix_profile_type_t; 45 46 typedef struct _bcm_ipfix_profile_def_s { 47 _bcm_ipfix_profile_type_t type; 48 soc_field_t index_field; /* associated field id in ING_IPFIX_PROFILEm */ 49 struct { 50 _bcm_ipfix_profile_id_t profile_id; 51 int reg_mem_id[2]; /* soc_reg_t or soc_mem_t */ 52 int entry_words[2]; /* word size for memory entry */ 53 } stage[2]; /* one for ingress, one for egress */ 54 } _bcm_ipfix_profile_def_t; 55 56 typedef struct _bcm_ipfix_id_def_s { 57 soc_reg_t port_config[2]; 58 soc_mem_t profile[2]; 59 soc_mem_t export_fifo[2]; 60 soc_reg_t age_control[2]; 61 soc_reg_t mirror_control[2]; 62 soc_field_t mtp_index[4]; 63 } _bcm_ipfix_id_def_t; 64 65 typedef struct _bcm_ipfix_flags_def_s { 66 uint32 bit_mask; 67 soc_field_t field; 68 } _bcm_ipfix_flags_def_t; 69 70 typedef enum _bcm_ipfix_callback_state_e { 71 _BCM_IPFIX_CALLBACK_STATE_INVALID = 0, 72 _BCM_IPFIX_CALLBACK_STATE_ACTIVE, 73 _BCM_IPFIX_CALLBACK_STATE_REGISTERED, 74 _BCM_IPFIX_CALLBACK_STATE_UNREGISTERED 75 } _bcm_ipfix_callback_state_t; 76 77 typedef struct _bcm_ipfix_callback_entry_s { 78 VOL _bcm_ipfix_callback_state_t state; 79 bcm_ipfix_callback_t callback; 80 void *userdata; 81 } _bcm_ipfix_callback_entry_t; 82 83 typedef struct _bcm_ipfix_ctrl_s { 84 /* per unit profiles array is indexed by _bcm_ipfix_profile_id_t */ 85 union { 86 soc_profile_reg_t reg; 87 soc_profile_mem_t mem; 88 } profiles[_BCM_IPFIX_PROFILE_ID_COUNT]; 89 SHR_BITDCL *rate_used_bmp; 90 int rate_used_count; 91 _bcm_ipfix_callback_entry_t callback_entry[_BCM_IPFIX_CB_MAX]; 92 sal_thread_t pid; /* export fifo processing thread process id */ 93 VOL sal_usecs_t interval; /* export fifo processing polling interval */ 94 int dma_chan[2]; /* export fifo DMA channel number */ 95 } _bcm_ipfix_ctrl_t; 96 97 #define _BCM_IPFIX_RATE_MIRROR_COUNT 4 98 99 extern void bcm_ipfix_dump_export_entry(int unit, bcm_ipfix_data_t *data); 100 extern int bcm_ipfix_export_fifo_control(int unit, sal_usecs_t interval); 101 extern int _bcm_tr_ipfix_rate_id_check(int unit, bcm_ipfix_rate_id_t rate_id); 102 extern int _bcm_esw_ipfix_deinit(int unit); 103 104 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 105 extern void _bcm_ipfix_sw_dump(int unit); 106 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 107 108 #ifdef BCM_WARM_BOOT_SUPPORT 109 extern int _bcm_esw_ipfix_sync(int unit); 110 #endif /* BCM_WARM_BOOT_SUPPORT */ 111 112 #endif /* !_BCM_INT_IPFIX_H */