ifa.h (8204B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_IFA_H__ 14 #define __BCM_IFA_H__ 15 16 #include <bcm/types.h> 17 18 /* IFA configuration information data. */ 19 typedef struct bcm_ifa_config_info_s { 20 uint32 probemarker_1; /* INT header ProbeMarker1 Value. */ 21 uint32 probemarker_2; /* INT header ProbeMarker2 Value. */ 22 uint32 device_id; /* Meta Data header Device ID. */ 23 uint16 max_payload_length; /* INT header Maximum payload. */ 24 uint16 module_id; /* Meta Data header Module Id used to 25 identify loopback source port 26 information. */ 27 uint8 hop_limit; /* INT header Hop Limit condition. */ 28 uint16 rx_packet_payload_length; /* Recieved packet payload length that 29 can be sent to collector. */ 30 uint16 lb_port_1; /* Loopback port for IFA E_APP. */ 31 uint16 lb_port_2; /* Loopback port for IFA E_APP. */ 32 uint8 optional_headers; /* Option to send with recieved packet 33 headers. */ 34 uint8 true_hop_count; /* Number of hops in the topology is 35 greater than Hop limit, IFA MD stack 36 contains Hop limit number of MDs in 37 MD stack. */ 38 } bcm_ifa_config_info_t; 39 40 /* IFA statistics information data. */ 41 typedef struct bcm_ifa_stat_info_s { 42 uint32 rx_pkt_cnt; /* Number of packet recieved in FW. */ 43 uint32 tx_pkt_cnt; /* Number of packet transmitted from FW. */ 44 uint32 ifa_no_config_drop; /* Number of pkt dropped due to missing 45 configuration. */ 46 uint32 ifa_collector_not_present_drop; /* Number of pkt dropped due to missing 47 collector configuration. */ 48 uint32 ifa_hop_cnt_invalid_drop; /* Number of pkt dropped due to Hop 49 count and Hop limit are out of order. */ 50 uint32 ifa_int_hdr_len_invalid_drop; /* Number of pkt dropped due to maximum 51 length and current length are out of 52 order. */ 53 uint32 ifa_pkt_size_invalid_drop; /* Number of pkt dropped due to invalid 54 packet size. */ 55 } bcm_ifa_stat_info_t; 56 57 /* 58 * Macros for bcm_ifa_collector_eth_header_t.vlan_tag_structure to 59 * indicate the tag structure of vlans. 60 */ 61 #define BCM_IFA_COLLECTOR_ETH_HDR_UNTAGGED 0x1 62 #define BCM_IFA_COLLECTOR_ETH_HDR_SINGLE_TAGGED 0x2 63 #define BCM_IFA_COLLECTOR_ETH_HDR_DOUBLE_TAGGED 0x3 64 65 /* 66 * Ethernet header in the encap used to send the IFA packet to the 67 * collector. 68 */ 69 typedef struct bcm_ifa_collector_eth_header_s { 70 bcm_mac_t dst_mac; 71 bcm_mac_t src_mac; 72 uint8 vlan_tag_structure; 73 uint16 outer_tpid; 74 uint16 inner_tpid; 75 bcm_vlan_tag_t outer_vlan_tag; 76 bcm_vlan_tag_t inner_vlan_tag; 77 } bcm_ifa_collector_eth_header_t; 78 79 /* IPv4 header in the encap used to send the IFA packet to the collector. */ 80 typedef struct bcm_ifa_collector_ipv4_header_s { 81 bcm_ip_t src_ip; 82 bcm_ip_t dst_ip; 83 uint8 dscp; 84 uint8 ttl; 85 } bcm_ifa_collector_ipv4_header_t; 86 87 /* IPv6 header in the encap used to send the IFA packet to the collector. */ 88 typedef struct bcm_ifa_collector_ipv6_header_s { 89 bcm_ip6_t src_ip; 90 bcm_ip6_t dst_ip; 91 uint8 traffic_class; 92 uint32 flow_label; 93 uint8 hop_limit; 94 } bcm_ifa_collector_ipv6_header_t; 95 96 /* UDP header in the encap used to send the IFA packet to the collector. */ 97 typedef struct bcm_ifa_collector_udp_header_s { 98 bcm_l4_port_t src_port; 99 bcm_l4_port_t dst_port; 100 } bcm_ifa_collector_udp_header_t; 101 102 /* Transport types that are supported for the collector */ 103 typedef enum bcm_ifa_collector_transport_type_e { 104 bcmIfaCollectorTransportTypeIpv4Udp = 0, /* The encap will be of the format UDP 105 over IPv4. */ 106 bcmIfaCollectorTransportTypeIpv6Udp = 1 /* The encap will be of the format UDP 107 over IPv6. */ 108 } bcm_ifa_collector_transport_type_t; 109 110 /* In-band flow analyzer collector information. */ 111 typedef struct bcm_ifa_collector_info_s { 112 bcm_ifa_collector_transport_type_t transport_type; /* Transport type used for sending data 113 to the collector. */ 114 bcm_ifa_collector_eth_header_t eth; /* Ethernet encapsulation of the packet 115 sent to collector. */ 116 bcm_ifa_collector_ipv4_header_t ipv4; /* IPv4 encapsulation of the packet sent 117 to collector. */ 118 bcm_ifa_collector_ipv6_header_t ipv6; /* IPv6 encapsulation of the packet sent 119 to collector. */ 120 bcm_ifa_collector_udp_header_t udp; /* UDP encapsulation of the packet sent 121 to collector. */ 122 uint16 mtu; /* The maximum packet length transmitted 123 by collector. */ 124 } bcm_ifa_collector_info_t; 125 126 #ifndef BCM_HIDE_DISPATCHABLE 127 128 /* Initialize the In-band flow analyzer subsystem. */ 129 extern int bcm_ifa_init( 130 int unit); 131 132 /* Shut down the In-band flow analyzer subsystem. */ 133 extern int bcm_ifa_detach( 134 int unit); 135 136 #endif /* BCM_HIDE_DISPATCHABLE */ 137 138 /* 139 * Options that can be passed via options parameter during configuration 140 * set. 141 */ 142 #define BCM_IFA_CONFIG_ADD (1 << 0) /* Add configuration to transfer ifa 143 information. */ 144 #define BCM_IFA_CONFIG_MODIFY (1 << 1) /* Update a configuration 145 information. */ 146 #define BCM_IFA_CONFIG_CLEAR (1 << 2) /* Clear configuration information. */ 147 148 /* Options that can be passed via options parameter during collector set. */ 149 #define BCM_IFA_COLLECTOR_ADD (1 << 0) /* Add collector to transfer ifa 150 information. */ 151 #define BCM_IFA_COLLECTOR_MODIFY (1 << 1) /* Update a collector 152 information. */ 153 #define BCM_IFA_COLLECTOR_DETACH (1 << 2) /* Detach collector. */ 154 155 #ifndef BCM_HIDE_DISPATCHABLE 156 157 /* Create a ifa collector with given collector info. */ 158 extern int bcm_ifa_collector_set( 159 int unit, 160 uint32 options, 161 bcm_ifa_collector_info_t *collector_info); 162 163 /* Get ifa collector information. */ 164 extern int bcm_ifa_collector_get( 165 int unit, 166 bcm_ifa_collector_info_t *collector_info); 167 168 /* Set IFA - INT and Meta data header configuration information */ 169 extern int bcm_ifa_config_info_set( 170 int unit, 171 uint32 options, 172 bcm_ifa_config_info_t *config_data); 173 174 /* Get IFA - INT and Meta data header configuration information */ 175 extern int bcm_ifa_config_info_get( 176 int unit, 177 bcm_ifa_config_info_t *config_data); 178 179 /* Get IFA - statistics information */ 180 extern int bcm_ifa_stat_info_get( 181 int unit, 182 bcm_ifa_stat_info_t *stat_data); 183 184 #endif /* BCM_HIDE_DISPATCHABLE */ 185 186 /* Initialize a ifa configuration information structure. */ 187 extern void bcm_ifa_config_info_t_init( 188 bcm_ifa_config_info_t *config_info); 189 190 /* Initialize a ifa collector information structure. */ 191 extern void bcm_ifa_collector_info_t_init( 192 bcm_ifa_collector_info_t *collector_info); 193 194 #ifndef BCM_HIDE_DISPATCHABLE 195 196 /* Set IFA - statistics information */ 197 extern int bcm_ifa_stat_info_set( 198 int unit, 199 bcm_ifa_stat_info_t *stat_data); 200 201 #endif /* BCM_HIDE_DISPATCHABLE */ 202 203 #endif /* __BCM_IFA_H__ */