flowtracker.h (150148B)
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 */ 9 10 #ifndef __BCM_FLOWTRACKER_H__ 11 #define __BCM_FLOWTRACKER_H__ 12 13 #include <bcm/port.h> 14 #include <bcm/collector.h> 15 #include <bcm/pkt.h> 16 17 /* Flowtracker IPFIX observation domain. */ 18 typedef uint32 bcm_flowtracker_ipfix_observation_domain_t; 19 20 /* The different timestamp sources in flowtracker to compute time delay */ 21 typedef enum bcm_flowtracker_timestamp_source_e { 22 bcmFlowtrackerTimestampSourceLegacy = 0, /* Legacy source */ 23 bcmFlowtrackerTimestampSourceNTP = 1, /* Network Time Protocol source */ 24 bcmFlowtrackerTimestampSourcePTP = 2, /* Precision Time Protocol source */ 25 bcmFlowtrackerTimestampSourceCMIC = 3, /* CMIC source */ 26 bcmFlowtrackerTimestampSourceIngressFlowtrackerStage = 4, /* Timestamp from logical table select 27 table */ 28 bcmFlowtrackerTimestampSourcePacket = 5, /* Timestamp captured from incoming 29 packet */ 30 bcmFlowtrackerTimestampSourceIngress = 6, /* Timestamp captured when packet 31 ingressed in pipeline */ 32 bcmFlowtrackerTimestampSourceNewLearn = 7, /* Timestamp captured when flow got 33 learnt */ 34 bcmFlowtrackerTimestampSourceFlowStart = 8, /* Timestamp captured when flow started */ 35 bcmFlowtrackerTimestampSourceFlowEnd = 9, /* Timestamp captured when flow ended */ 36 bcmFlowtrackerTimestampSourceCheckEvent1 = 10, /* Timestamp captured when event1 37 happened in checker */ 38 bcmFlowtrackerTimestampSourceCheckEvent2 = 11, /* Timestamp captured when event2 39 happened in checker */ 40 bcmFlowtrackerTimestampSourceCheckEvent3 = 12, /* Timestamp captured when event3 41 happened in checker */ 42 bcmFlowtrackerTimestampSourceCheckEvent4 = 13, /* Timestamp captured when event4 43 happened in checker */ 44 bcmFlowtrackerTimestampSourceCMICTxStart = 14, /* Timestamp captured at egress when 45 packet tx start */ 46 bcmFlowtrackerTimestampSourceCMICTxEnd = 15, /* Timestamp captured at egress when 47 packet tx end */ 48 bcmFlowtrackerTimestampSourceCount = 16 /* Always Last. Not a usable value */ 49 } bcm_flowtracker_timestamp_source_t; 50 51 #define BCM_FLOWTRACKER_TIMESTAMP_SOURCE_STRINGS \ 52 { \ 53 "Legacy", \ 54 "NTP", \ 55 "PTP", \ 56 "CMIC", \ 57 "IngressFlowtrackerStage", \ 58 "Packet", \ 59 "Ingress", \ 60 "NewLearn", \ 61 "FlowStart", \ 62 "FlowEnd", \ 63 "CheckEvent1", \ 64 "CheckEvent2", \ 65 "CheckEvent3", \ 66 "CheckEvent4", \ 67 "CMICTxStart", \ 68 "CMICTxEnd" \ 69 } 70 71 /* Flowtracker Drop Reason in pipeline. */ 72 typedef enum bcm_flowtracker_drop_reason_e { 73 bcmFlowtrackerDropReasonInvalid = 0, /* Invalid packet drop reason */ 74 bcmFlowtrackerDropReasonMmuIngressPortPG = 1, /* Packet dropped at Mmu due to */ 75 bcmFlowtrackerDropReasonMmuIngressPortPool = 2, /* Packet dropped at Mmu due to */ 76 bcmFlowtrackerDropReasonMmuIngressPortGreen = 3, /* Packet dropped at Mmu due to */ 77 bcmFlowtrackerDropReasonMmuIngressPortYellow = 4, /* Packet dropped at Mmu due to */ 78 bcmFlowtrackerDropReasonMmuIngressPortRed = 5, /* Packet dropped at Mmu due to */ 79 bcmFlowtrackerDropReasonMmuIngressHeadroom = 6, /* Packet dropped at Mmu due to */ 80 bcmFlowtrackerDropReasonMmuEgressUCQueueGreen = 7, /* Packet dropped at Mmu due to */ 81 bcmFlowtrackerDropReasonMmuEgressUCQueueYellow = 8, /* Packet dropped at Mmu due to */ 82 bcmFlowtrackerDropReasonMmuEgressUCQueueRed = 9, /* Packet dropped at Mmu due to */ 83 bcmFlowtrackerDropReasonMmuEgressUCQueueGroupGreen = 10, /* Packet dropped at Mmu due to */ 84 bcmFlowtrackerDropReasonMmuEgressUCQueueGroupYellow = 11, /* Packet dropped at Mmu due to */ 85 bcmFlowtrackerDropReasonMmuEgressUCQueueGroupRed = 12, /* Packet dropped at Mmu due to */ 86 bcmFlowtrackerDropReasonMmuEgressUCPortPoolGreen = 13, /* Packet dropped at Mmu due to */ 87 bcmFlowtrackerDropReasonMmuEgressUCPortPoolYellow = 14, /* Packet dropped at Mmu due to */ 88 bcmFlowtrackerDropReasonMmuEgressUCPortPoolRed = 15, /* Packet dropped at Mmu due to */ 89 bcmFlowtrackerDropReasonMmuEgressUCPoolGreen = 16, /* Packet dropped at Mmu due to */ 90 bcmFlowtrackerDropReasonMmuEgressUCPoolYellow = 17, /* Packet dropped at Mmu due to */ 91 bcmFlowtrackerDropReasonMmuEgressUCPoolRed = 18, /* Packet dropped at Mmu due to */ 92 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueGreen = 19, /* Packet dropped at Mmu due to */ 93 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueYellow = 20, /* Packet dropped at Mmu due to */ 94 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueRed = 21, /* Packet dropped at Mmu due to */ 95 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueGroupGreen = 22, /* Packet dropped at Mmu due to */ 96 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueGroupYellow = 23, /* Packet dropped at Mmu due to */ 97 bcmFlowtrackerDropReasonMmuEgressWREDUCQueueGroupRed = 24, /* Packet dropped at Mmu due to */ 98 bcmFlowtrackerDropReasonMmuEgressWREDUCPortPoolGreen = 25, /* Packet dropped at Mmu due to */ 99 bcmFlowtrackerDropReasonMmuEgressWREDUCPortPoolYellow = 26, /* Packet dropped at Mmu due to */ 100 bcmFlowtrackerDropReasonMmuEgressWREDUCPortPoolRed = 27, /* Packet dropped at Mmu due to */ 101 bcmFlowtrackerDropReasonMmuEgressWREDUCMin = 28, /* Packet dropped at Mmu due to */ 102 bcmFlowtrackerDropReasonMmuEgressWREDUCPool = 29, /* Packet dropped at Mmu due to */ 103 bcmFlowtrackerDropReasonMmuEgressRQEQueueGreen = 30, /* Packet dropped at Mmu due to */ 104 bcmFlowtrackerDropReasonMmuEgressRQEQueueYellow = 31, /* Packet dropped at Mmu due to */ 105 bcmFlowtrackerDropReasonMmuEgressRQEQueueRed = 32, /* Packet dropped at Mmu due to */ 106 bcmFlowtrackerDropReasonMmuEgressRQEPoolGreen = 33, /* Packet dropped at Mmu due to */ 107 bcmFlowtrackerDropReasonMmuEgressRQEPoolYellow = 34, /* Packet dropped at Mmu due to */ 108 bcmFlowtrackerDropReasonMmuEgressRQEPoolRed = 35, /* Packet dropped at Mmu due to */ 109 bcmFlowtrackerDropReasonMmuEgressMCQueueGreen = 36, /* Packet dropped at Mmu due to */ 110 bcmFlowtrackerDropReasonMmuEgressMCQueueYellow = 37, /* Packet dropped at Mmu due to */ 111 bcmFlowtrackerDropReasonMmuEgressMCQueueRed = 38, /* Packet dropped at Mmu due to */ 112 bcmFlowtrackerDropReasonMmuEgressMCPortPoolGreen = 39, /* Packet dropped at Mmu due to */ 113 bcmFlowtrackerDropReasonMmuEgressMCPortPoolYellow = 40, /* Packet dropped at Mmu due to */ 114 bcmFlowtrackerDropReasonMmuEgressMCPortPoolRed = 41, /* Packet dropped at Mmu due to */ 115 bcmFlowtrackerDropReasonMmuEgressMCPoolGreen = 42, /* Packet dropped at Mmu due to */ 116 bcmFlowtrackerDropReasonMmuEgressMCPoolYellow = 43, /* Packet dropped at Mmu due to */ 117 bcmFlowtrackerDropReasonMmuEgressMCPoolRed = 44, /* Packet dropped at Mmu due to */ 118 bcmFlowtrackerDropReasonMmuCFAP = 45, /* Packet dropped at Mmu due to */ 119 bcmFlowtrackerDropReasonMmuIngressWRED = 46, /* Packet dropped at Mmu due to */ 120 bcmFlowtrackerDropReasonMmuEgressUC = 47, /* Packet dropped at Mmu due to */ 121 bcmFlowtrackerDropReasonMmuIngress = 48, /* Packet dropped at Mmu due to */ 122 bcmFlowtrackerDropReasonMmuEgressMC = 49, /* Packet dropped at Mmu due to */ 123 bcmFlowtrackerDropReasonMmuEgressRQE = 50, /* Packet dropped at Mmu due to */ 124 bcmFlowtrackerDropReasonMmu = 51, /* Packet dropped by MMU. */ 125 bcmFlowtrackerDropReasonMmuIpMtu = 52, /* Packet dropped at Mmu due to IP MTU 126 check fail. */ 127 bcmFlowtrackerDropReasonIngControlFrame = 53, /* Packet dropped at ingress due to 128 control frame. */ 129 bcmFlowtrackerDropReasonIngL3DosAttack = 54, /* Packet dropped at ingress due to L3 130 Dos attack. */ 131 bcmFlowtrackerDropReasonIngHigigLoopback = 55, /* Packet dropped at ingress due to 132 HiGig loopback. */ 133 bcmFlowtrackerDropReasonIngiHigigUnknownOpcode = 56, /* Packet dropped at ingress due to 134 HiGig unknown opcode. */ 135 bcmFlowtrackerDropReasonIngHigigHdrError = 57, /* Packet dropped at ingress due to 136 HiGig header error. */ 137 bcmFlowtrackerDropReasonIngLagFailLoopback = 58, /* Packet dropped at ingress due to link 138 aggregation loopback fail. */ 139 bcmFlowtrackerDropReasonIngMacSAEqualsDA = 59, /* Packet dropped at ingress due to MAC 140 source address equals destination 141 address. */ 142 bcmFlowtrackerDropReasonIngL4DosAttack = 60, /* Packet dropped at ingress due to L4 143 Dos attack. */ 144 bcmFlowtrackerDropReasonIngNIVDot1p = 61, /* Packet dropped at ingress due to NIV 145 DOT1P. */ 146 bcmFlowtrackerDropReasonIngNIVVntagPresent = 62, /* Packet dropped at ingress due to NIV 147 VNTAG present. */ 148 bcmFlowtrackerDropReasonIngNIVVntagNotPresent = 63, /* Packet dropped at ingress due to NIV 149 VNTAG not present. */ 150 bcmFlowtrackerDropReasonIngNIVVntagFormat = 64, /* Packet dropped at ingress due to NIV 151 VNTAG format. */ 152 bcmFlowtrackerDropReasonIngUnknownSubtendingPort = 65, /* Packet dropped at ingress due to 153 unknown subtending port. */ 154 bcmFlowtrackerDropReasonIngIPinIPTunnelProcess = 66, /* Packet dropped at ingress due to IP 155 in IP tunnel process failure. */ 156 bcmFlowtrackerDropReasonIngMiMTunnelProcess = 67, /* Packet dropped at ingress due to MiM 157 tunnel process failure. */ 158 bcmFlowtrackerDropReasonIngTunnelInterfaceCheck = 68, /* Packet dropped at ingress due to 159 tunnel interface check failure. */ 160 bcmFlowtrackerDropReasonIngMplsInvalidControlWord = 69, /* Packet dropped at ingress due to MPLS 161 invalid control word. */ 162 bcmFlowtrackerDropReasonIngMplsGalNotBos = 70, /* Packet dropped at ingress due to MPLS 163 Generic Label is not BOS. */ 164 bcmFlowtrackerDropReasonIngMplsInvalidPayload = 71, /* Packet dropped at ingress due to MPLS 165 invalid payload. */ 166 bcmFlowtrackerDropReasonIngMplsEntropyLabel = 72, /* Packet dropped at ingress due to MPLS 167 entropy label in unallowed range. */ 168 bcmFlowtrackerDropReasonIngMplsLabelLookupMiss = 73, /* Packet dropped at ingress due to MPLS 169 label loopkup miss. */ 170 bcmFlowtrackerDropReasonIngMplsInvalidAction = 74, /* Packet dropped at ingress due to MPLS 171 invalid action. */ 172 bcmFlowtrackerDropReasonIngTunnelTTLCheck = 75, /* Packet dropped at ingress due to 173 tunnel ttl check failure. */ 174 bcmFlowtrackerDropReasonIngTunnelSHIMHDRError = 76, /* Packet dropped at ingress due to 175 tunnel shim header error. */ 176 bcmFlowtrackerDropReasonIngObjValidation = 77, /* Packet dropped at ingress due to 177 tunnel object validation failure. */ 178 bcmFlowtrackerDropReasonIngInvalidVlan = 78, /* Packet dropped at ingress due to VLAN 179 not valid. */ 180 bcmFlowtrackerDropReasonIngPortNotInVlanMember = 79, /* Packet dropped at ingress due to port 181 not in VLAN membership. */ 182 bcmFlowtrackerDropReasonIngInvalidTpid = 80, /* Packet dropped at ingress due to TPID 183 mismatch. */ 184 bcmFlowtrackerDropReasonIngPvlanMismatch = 81, /* Packet dropped at ingress due to 185 PVLAN VID mismatch. */ 186 bcmFlowtrackerDropReasonIngMACIPBindCheck = 82, /* Packet dropped at ingress due to mac 187 ip bind check failure. */ 188 bcmFlowtrackerDropReasonIngTunnelAdapt4LookupMiss = 83, /* Packet dropped at ingress due to 189 tunnel adaptation table 4 lookup 190 miss. */ 191 bcmFlowtrackerDropReasonIngTunnelAdapt3LookupMiss = 84, /* Packet dropped at ingress due to 192 tunnel adaptation table 3 lookup 193 miss. */ 194 bcmFlowtrackerDropReasonIngTunnelAdapt2LookupMiss = 85, /* Packet dropped at ingress due to 195 tunnel adaptation table 2 lookup 196 miss. */ 197 bcmFlowtrackerDropReasonIngTunnelAdapt1LookupMiss = 86, /* Packet dropped at ingress due to 198 tunnel adaptation table 1 lookup 199 miss. */ 200 bcmFlowtrackerDropReasonIngFieldProcessorLookup = 87, /* Packet dropped at ingress due to 201 field processor lookup stage. */ 202 bcmFlowtrackerDropReasonIngFcoeVft = 88, /* Packet dropped at ingress due to Fcoe 203 VFT drop. */ 204 bcmFlowtrackerDropReasonIngFcoeSrcBindCheck = 89, /* Packet dropped at ingress due to FCOE 205 source bind check failure. */ 206 bcmFlowtrackerDropReasonIngFcoeSrcFpmaCheck = 90, /* Packet dropped at ingress due to 207 source FPMA prefix check failure. */ 208 bcmFlowtrackerDropReasonIngVfiPt2Pt = 91, /* Packet dropped at ingress due to 209 arrival from a vp that is not 210 programmed in PT2PT connection. */ 211 bcmFlowtrackerDropReasonIngSpanningTreeNotForwarding = 92, /* Packet dropped at ingress due to 212 Spanning tree not forwarding. */ 213 bcmFlowtrackerDropReasonIngMcastIndexError = 93, /* Packet dropped at ingress due to 214 multicast index error. */ 215 bcmFlowtrackerDropReasonIngCompositeError = 94, /* Packet dropped at ingress due to HW 216 related error like lookup table with 217 parity error. */ 218 bcmFlowtrackerDropReasonIngBpdu = 95, /* BPDU packet drop at ingress. */ 219 bcmFlowtrackerDropReasonIngProtocol = 96, /* Protocol packet drop at ingress. */ 220 bcmFlowtrackerDropReasonIngCml = 97, /* Packet dropped at ingress due to CML 221 bit. */ 222 bcmFlowtrackerDropReasonIngSrcRoute = 98, /* Packet dropped at ingress due to 223 source route. */ 224 bcmFlowtrackerDropReasonIngL2SrcDiscard = 99, /* Packet dropped at ingress due to L2 225 source discard. */ 226 bcmFlowtrackerDropReasonIngL2SrcStaticMove = 100, /* Packet dropped at ingress due to L2 227 source static move. */ 228 bcmFlowtrackerDropReasonIngL2DstDiscard = 101, /* Packet dropped at ingress due to L2 229 destination discard. */ 230 bcmFlowtrackerDropReasonIngL3Disable = 102, /* Packet dropped at ingress due to L3 231 disabled. */ 232 bcmFlowtrackerDropReasonIngSrcMacZero = 103, /* Packet dropped at ingress due to 233 source mac zero. */ 234 bcmFlowtrackerDropReasonIngVLANCC = 104, /* Packet dropped at ingress due to vlan 235 cc or pbt failure. */ 236 bcmFlowtrackerDropReasonIngClassBasedSM = 105, /* Packet dropped at ingress due to 237 class based SM failure. */ 238 bcmFlowtrackerDropReasonIngTimeSyncPkt = 106, /* Network time sync packet drop at 239 ingress. */ 240 bcmFlowtrackerDropReasonIngIPMCProcess = 107, /* Packet dropped at ingress due to ipmc 241 process failure. */ 242 bcmFlowtrackerDropReasonIngMyStation = 108, /* Packet dropped at ingress due to my 243 station. */ 244 bcmFlowtrackerDropReasonIngPvlanVpFilter = 109, /* Packet dropped at ingress due to 245 pvlan vp filer. */ 246 bcmFlowtrackerDropReasonIngPktFlowSelectMiss = 110, /* Packet dropped at ingress due to flow 247 select miss. */ 248 bcmFlowtrackerDropReasonIngL3DstDiscard = 111, /* Packet dropped at Mmu due to L3 249 destination discard at ingress. */ 250 bcmFlowtrackerDropReasonIngTunnelDecapECN = 112, /* Packet dropped at ingress due to 251 tunnel decap ECN. */ 252 bcmFlowtrackerDropReasonIngPktFlowSelectAction = 113, /* Packet dropped at ingress due to flow 253 select action. */ 254 bcmFlowtrackerDropReasonIngL3SrcDiscard = 114, /* Packet dropped at ingress due to L3 255 source discard. */ 256 bcmFlowtrackerDropReasonIngFcoeZoneLookupMiss = 115, /* Packet dropped at ingress due to fcoe 257 zone lookup miss. */ 258 bcmFlowtrackerDropReasonIngL3Ttl = 116, /* Packet dropped at ingress due to l3 259 ttl error. */ 260 bcmFlowtrackerDropReasonIngL3Hdr = 117, /* Packet dropped at ingress due to l3 261 header error. */ 262 bcmFlowtrackerDropReasonIngL2Hdr = 118, /* Packet dropped at ingress due to l2 263 header error. */ 264 bcmFlowtrackerDropReasonIngL3SrcLookupMiss = 119, /* Packet dropped at ingress due to l3 265 source lookup miss. */ 266 bcmFlowtrackerDropReasonIngL3DstLookupMiss = 120, /* Packet dropped at ingress due to l3 267 destination lookup miss. */ 268 bcmFlowtrackerDropReasonIngL2TtlError = 121, /* Packet dropped at ingress due to l2 269 ttl error. */ 270 bcmFlowtrackerDropReasonIngL2RpfCheck = 122, /* Packet dropped at ingress due to l2 271 rpf check. */ 272 bcmFlowtrackerDropReasonIngPfm = 123, /* Packet dropped at ingress due to port 273 filtering mode. */ 274 bcmFlowtrackerDropReasonIngTagUntagDiscard = 124, /* Packet dropped at ingress due to port 275 untag discard. */ 276 bcmFlowtrackerDropReasonIngEcmpResolution = 125, /* Packet dropped at ingress due to ecmp 277 resolution. */ 278 bcmFlowtrackerDropReasonIngStormControl = 126, /* Packet dropped at ingress due to 279 storm control metering. */ 280 bcmFlowtrackerDropReasonIngFcoeZoneCheck = 127, /* Packet dropped at ingress due to FCOE 281 zone check is a miss */ 282 bcmFlowtrackerDropReasonIngFPChangeL2FieldNoRedirectDrop = 128, /* Packet dropped at ingress due to l2 283 field no direct drop. */ 284 bcmFlowtrackerDropReasonIngMulticast = 129, /* Multicast Packet dropped at ingress. */ 285 bcmFlowtrackerDropReasonIngTunnelError = 130, /* Packet dropped at ingress due to 286 tunnel error. */ 287 bcmFlowtrackerDropReasonIngNextHop = 131, /* Next Hop drop at ingress. */ 288 bcmFlowtrackerDropReasonIngUrpfCheck = 132, /* Packet dropped at ingress due to urpf 289 check failure. */ 290 bcmFlowtrackerDropReasonIngNat = 133, /* NAT process failure eg. destination 291 lookup miss or Hairpin drop at 292 ingress. */ 293 bcmFlowtrackerDropReasonIngProtectionData = 134, /* Packet dropped at ingress due to 294 protection data. */ 295 bcmFlowtrackerDropReasonIngStageIngress = 135, /* Packet dropped at ingress due to 296 field ingress stage. */ 297 bcmFlowtrackerDropReasonEgrAdapt1Miss = 136, /* Packet dropped at egress due to 298 ADAPT_1 miss drop condition. */ 299 bcmFlowtrackerDropReasonEgrAdapt2Miss = 137, /* Packet dropped at egress due to 300 ADAPT_2 miss drop condition. */ 301 bcmFlowtrackerDropReasonEgrTtl = 138, /* Packet dropped at egress due to TTL. */ 302 bcmFlowtrackerDropReasonEgrFwdDomainNotFound = 139, /* Packet dropped at egress due to 303 FWD_DOMAIN not found error. */ 304 bcmFlowtrackerDropReasonEgrFwdDomainNotMember = 140, /* Packet dropped at egress due to 305 packet not member of FWD_DOMAIN. */ 306 bcmFlowtrackerDropReasonEgrStgBlock = 141, /* Packet dropped at egress due to 307 spanning tree. */ 308 bcmFlowtrackerDropReasonEgrIpmcL2Self = 142, /* Packet dropped at egress due to IPMC 309 L2 self port. */ 310 bcmFlowtrackerDropReasonEgrNonUCastPrune = 143, /* Packet dropped at egress due to non 311 unicast prune drop. */ 312 bcmFlowtrackerDropReasonEgrSrcVirtualPort = 144, /* Packet dropped at egress due to 313 source virtual port removal. */ 314 bcmFlowtrackerDropReasonEgrVplagPrune = 145, /* Packet dropped at egress due to VPLAG 315 packet pruning. */ 316 bcmFlowtrackerDropReasonEgrSplitHorizon = 146, /* Packet dropped at egress due to split 317 horizon. */ 318 bcmFlowtrackerDropReasonEgrIpmcL3SelfIntf = 147, /* Packet dropped at egress due to IPMC 319 L3 Self Interface. */ 320 bcmFlowtrackerDropReasonEgrPurgePkt = 148, /* Packet dropped at egress due to 321 purge. */ 322 bcmFlowtrackerDropReasonEgrStgDisable = 149, /* Packet dropped at egress due to 323 spanning tree disabled. */ 324 bcmFlowtrackerDropReasonEgrAgedPkt = 150, /* Packet dropped at egress due to 325 packet aging. */ 326 bcmFlowtrackerDropReasonEgrL2MtuFail = 151, /* Packet dropped at egress due to L2 327 MTU fail. */ 328 bcmFlowtrackerDropReasonEgrParity = 152, /* Packet dropped at egress due to 329 parity error. */ 330 bcmFlowtrackerDropReasonEgrPortEgress = 153, /* Packet dropped at egress due to 331 egress port. */ 332 bcmFlowtrackerDropReasonEgrFieldProcessor = 154, /* Packet dropped at egress due to 333 egress field processor. */ 334 bcmFlowtrackerDropReasonEgrEPAdditionTooLarge = 155, /* Packet dropped at egress due to EP 335 additions are too large. */ 336 bcmFlowtrackerDropReasonEgrNivPrune = 156, /* Packet dropped at egress due to 337 tunnel id not valid. */ 338 bcmFlowtrackerDropReasonEgrPacketFlowSelect = 157, /* Packet dropped at egress due to 339 PKT_FLOW_SELECT policy. */ 340 bcmFlowtrackerDropReasonEgrPacketTooSmall = 158, /* Packet dropped at egress due to small 341 size. */ 342 bcmFlowtrackerDropReasonEgrVisibilityPacket = 159, /* Visibility packet drop at egress. */ 343 bcmFlowtrackerDropReasonEgrInvalid1588Packet = 160, /* Packet dropped at egress as it is 344 invalid 1588 packet. */ 345 bcmFlowtrackerDropReasonEgrEcnTable = 161, /* Packet dropped at egress due to ECN 346 table. */ 347 bcmFlowtrackerDropReasonEgrHiGigReserved = 162, /* Packet dropped at egress due to HiGig 348 reserved drop. */ 349 bcmFlowtrackerDropReasonEgrHiGig2Reserved = 163, /* Packet dropped at egress due to 350 HiGig2 reserved drop. */ 351 bcmFlowtrackerDropReasonEgrBadTunnelDip = 164, /* Packet dropped at egress due to bad 352 tunnel DIP. */ 353 bcmFlowtrackerDropReasonEgrEsipLinkLocal = 165, /* Packet dropped at egress due to ESIP 354 Link local. */ 355 bcmFlowtrackerDropReasonEgrCfi = 166, /* CFI packet drop at egress. */ 356 bcmFlowtrackerDropReasonEgrFlowSelectMiss = 167, /* Packet dropped at egress due to look 357 up miss in PKT_FLOW_SELECT and 358 EGR_PKT_FLOW_SELECT tcams. */ 359 bcmFlowtrackerDropReasonEgrProtection = 168, /* Packet dropped at egress due to 360 protection from 361 EGR_L3_NEXT_HOP_1.DROP or 362 EGR_TX_PROT_GROUP_TABLE.DROP_BITMAP. */ 363 bcmFlowtrackerDropReasonEgrFlexEditor = 169, /* Packet dropped at egress due to 364 resource conflict or wrong 365 configuration in flex editor. */ 366 bcmFlowtrackerDropReasonEgrQosCtrl = 170, /* Packet dropped at egress due to 367 egress cosq control. */ 368 bcmFlowtrackerDropReasonCount = 171 /* Last Value. Not Usable. */ 369 } bcm_flowtracker_drop_reason_t; 370 371 #define BCM_FT_DROP_REASON_STRINGS \ 372 { \ 373 "Invalid", \ 374 "MmuIngressPortPG", \ 375 "MmuIngressPortPool", \ 376 "MmuIngressPortGreen", \ 377 "MmuIngressPortYellow", \ 378 "MmuIngressPortRed", \ 379 "MmuIngressHeadroom", \ 380 "MmuEgressUCQueueGreen", \ 381 "MmuEgressUCQueueYellow", \ 382 "MmuEgressUCQueueRed", \ 383 "MmuEgressUCQueueGroupGreen", \ 384 "MmuEgressUCQueueGroupYellow", \ 385 "MmuEgressUCQueueGroupRed", \ 386 "MmuEgressUCPortPoolGreen", \ 387 "MmuEgressUCPortPoolYellow", \ 388 "MmuEgressUCPortPoolRed", \ 389 "MmuEgressUCPoolGreen", \ 390 "MmuEgressUCPoolYellow", \ 391 "MmuEgressUCPoolRed", \ 392 "MmuEgressWREDUCQueueGreen", \ 393 "MmuEgressWREDUCQueueYellow", \ 394 "MmuEgressWREDUCQueueRed", \ 395 "MmuEgressWREDUCQueueGroupGreen", \ 396 "MmuEgressWREDUCQueueGroupYellow", \ 397 "MmuEgressWREDUCQueueGroupRed", \ 398 "MmuEgressWREDUCPortPoolGreen", \ 399 "MmuEgressWREDUCPortPoolYellow", \ 400 "MmuEgressWREDUCPortPoolRed", \ 401 "MmuEgressWREDUCMin", \ 402 "MmuEgressWREDUCPool", \ 403 "MmuEgressRQEQueueGreen", \ 404 "MmuEgressRQEQueueYellow", \ 405 "MmuEgressRQEQueueRed", \ 406 "MmuEgressRQEPoolGreen", \ 407 "MmuEgressRQEPoolYellow", \ 408 "MmuEgressRQEPoolRed", \ 409 "MmuEgressMCQueueGreen", \ 410 "MmuEgressMCQueueYellow", \ 411 "MmuEgressMCQueueRed", \ 412 "MmuEgressMCPortPoolGreen", \ 413 "MmuEgressMCPortPoolYellow", \ 414 "MmuEgressMCPortPoolRed", \ 415 "MmuEgressMCPoolGreen", \ 416 "MmuEgressMCPoolYellow", \ 417 "MmuEgressMCPoolRed", \ 418 "MmuCFAP", \ 419 "MmuIngressWRED", \ 420 "MmuEgressUC", \ 421 "MmuIngress", \ 422 "MmuEgressMC", \ 423 "MmuEgressRQE", \ 424 "Mmu", \ 425 "MmuIpMtu", \ 426 "IngControlFrame", \ 427 "IngL3DosAttack", \ 428 "IngHigigLoopback", \ 429 "IngiHigigUnknownOpcode", \ 430 "IngHigigHdrError", \ 431 "IngLagFailLoopback", \ 432 "IngMacSAEqualsDA", \ 433 "IngL4DosAttack", \ 434 "IngNIVDot1p", \ 435 "IngNIVVntagPresent", \ 436 "IngNIVVntagNotPresent", \ 437 "IngNIVVntagFormat", \ 438 "IngUnknownSubtendingPort", \ 439 "IngIPinIPTunnelProcess", \ 440 "IngMiMTunnelProcess", \ 441 "IngTunnelInterfaceCheck", \ 442 "IngMplsInvalidControlWord", \ 443 "IngMplsGalNotBos", \ 444 "IngMplsInvalidPayload", \ 445 "IngMplsEntropyLabel", \ 446 "IngMplsLabelLookupMiss", \ 447 "IngMplsInvalidAction", \ 448 "IngTunnelTTLCheck", \ 449 "IngTunnelSHIMHDRError", \ 450 "IngObjValidation", \ 451 "IngInvalidVlan", \ 452 "IngPortNotInVlanMember", \ 453 "IngInvalidTpid", \ 454 "IngPvlanMismatch", \ 455 "IngMACIPBindCheck", \ 456 "IngTunnelAdapt4LookupMiss", \ 457 "IngTunnelAdapt3LookupMiss", \ 458 "IngTunnelAdapt2LookupMiss", \ 459 "IngTunnelAdapt1LookupMiss", \ 460 "IngFieldProcessorLookup", \ 461 "IngFcoeVft", \ 462 "IngFcoeSrcBindCheck", \ 463 "IngFcoeSrcFpmaCheck", \ 464 "IngVfiPt2Pt", \ 465 "IngSpanningTreeNotForwarding", \ 466 "IngMcastIndexError", \ 467 "IngCompositeError", \ 468 "IngBpdu", \ 469 "IngProtocol", \ 470 "IngCml", \ 471 "IngSrcRoute", \ 472 "IngL2SrcDiscard", \ 473 "IngL2SrcStaticMove", \ 474 "IngL2DstDiscard", \ 475 "IngL3Disable", \ 476 "IngSrcMacZero", \ 477 "IngVLANCC", \ 478 "IngClassBasedSM", \ 479 "IngTimeSyncPkt", \ 480 "IngIPMCProcess", \ 481 "IngMyStation", \ 482 "IngPvlanVpFilter", \ 483 "IngPktFlowSelectMiss", \ 484 "IngL3DstDiscard", \ 485 "IngTunnelDecapECN", \ 486 "IngPktFlowSelectAction", \ 487 "IngL3SrcDiscard", \ 488 "IngFcoeZoneLookupMiss", \ 489 "IngL3Ttl", \ 490 "IngL3Hdr", \ 491 "IngL2Hdr", \ 492 "IngL3SrcLookupMiss", \ 493 "IngL3DstLookupMiss", \ 494 "IngL2TtlError", \ 495 "IngL2RpfCheck", \ 496 "IngPfm", \ 497 "IngTagUntagDiscard", \ 498 "IngEcmpResolution", \ 499 "IngStormControl", \ 500 "IngFcoeZoneCheck", \ 501 "IngFPChangeL2FieldNoRedirectDrop", \ 502 "IngMulticast", \ 503 "IngTunnelError", \ 504 "IngNextHop", \ 505 "IngUrpfCheck", \ 506 "IngNat", \ 507 "IngProtectionData", \ 508 "IngStageIngress", \ 509 "EgrAdapt1Miss", \ 510 "EgrAdapt2Miss", \ 511 "EgrTtl", \ 512 "EgrFwdDomainNotFound", \ 513 "EgrFwdDomainNotMember", \ 514 "EgrStgBlock", \ 515 "EgrIpmcL2Self", \ 516 "EgrNonUCastPrune", \ 517 "EgrSrcVirtualPort", \ 518 "EgrVplagPrune", \ 519 "EgrSplitHorizon", \ 520 "EgrIpmcL3SelfIntf", \ 521 "EgrPurgePkt", \ 522 "EgrStgDisable", \ 523 "EgrAgedPkt", \ 524 "EgrL2MtuFail", \ 525 "EgrParity", \ 526 "EgrPortEgress", \ 527 "EgrFieldProcessor", \ 528 "EgrEPAdditionTooLarge", \ 529 "EgrNivPrune", \ 530 "EgrPacketFlowSelect", \ 531 "EgrPacketTooSmall", \ 532 "EgrVisibilityPacket", \ 533 "EgrInvalid1588Packet", \ 534 "EgrEcnTable", \ 535 "EgrHiGigReserved", \ 536 "EgrHiGig2Reserved", \ 537 "EgrBadTunnelDip", \ 538 "EgrEsipLinkLocal", \ 539 "EgrCfi", \ 540 "EgrFlowSelectMiss", \ 541 "EgrProtection", \ 542 "EgrFlexEditor", \ 543 "EgrQosCtrl" \ 544 } 545 546 /* Flowtracker packet drop reasons. */ 547 typedef struct bcm_flowtracker_drop_reasons_s { 548 SHR_BITDCL rbits[_SHR_BITDCLSIZE(bcmFlowtrackerDropReasonCount)]; /* Bitmap of packet drop reasons in 549 flowtracker module. */ 550 } bcm_flowtracker_drop_reasons_t; 551 552 /* Manipulate Drop Reason Bitmap. */ 553 #define BCM_FLOWTRACKER_DROP_REASON_SET(_ft_drop_reasons, _reason) SHR_BITSET(((_ft_drop_reasons).rbits), (_reason)) 554 #define BCM_FLOWTRACKER_DROP_REASON_ING_MMU_SET_ALL(_ft_drop_reasons) SHR_BITSET_RANGE(((_ft_drop_reasons).rbits), 1, bcmFlowtrackerDropReasonIngStageIngress) 555 #define BCM_FLOWTRACKER_DROP_REASON_EGR_SET_ALL(_ft_drop_reasons) SHR_BITSET_RANGE(((_ft_drop_reasons).rbits), (bcmFlowtrackerDropReasonIngStageIngress + 1), (bcmFlowtrackerDropReasonCount - (bcmFlowtrackerDropReasonIngStageIngress + 1))) 556 #define BCM_FLOWTRACKER_DROP_REASON_GET(_ft_drop_reasons, _reason) SHR_BITGET(((_ft_drop_reasons).rbits), (_reason)) 557 #define BCM_FLOWTRACKER_DROP_REASON_CLEAR(_ft_drop_reasons, _reason) SHR_BITCLR(((_ft_drop_reasons).rbits), (_reason)) 558 #define BCM_FLOWTRACKER_DROP_REASON_CLEAR_ALL(_ft_drop_reasons) SHR_BITCLR_RANGE(((_ft_drop_reasons).rbits), 0, bcmFlowtrackerDropReasonCount) 559 #define BCM_FLOWTRACKER_DROP_REASON_IS_NULL(_ft_drop_reasons) SHR_BITNULL_RANGE(((_ft_drop_reasons).rbits), 0, bcmFlowtrackerDropReasonCount) 560 #define BCM_FLOWTRACKER_DROP_REASON_COUNT(_ft_drop_reasons, count) SHR_BITCOUNT_RANGE(((_ft_drop_reasons).rbits), count, 0 , bcmFlowtrackerDropReasonCount) 561 562 /* Flowtracker drop reason group identifier. */ 563 typedef uint32 bcm_flowtracker_drop_reason_group_t; 564 565 /* Flowtracker drop reason group defines. */ 566 #define BCM_FLOWTRACKER_DROP_REASON_GROUP_ID_MAX 16 /* Maximum number of drop 567 reason group id. */ 568 569 /* Drop Reason Group Creation flags. */ 570 #define BCM_FLOWTRACKER_DROP_REASON_GROUP_AGGREGATE_MMU (1 << 0) /* Drop Reason Group for 571 Aggregate MMU 572 Flowtracker Type. */ 573 #define BCM_FLOWTRACKER_DROP_REASON_GROUP_AGGREGATE_EGRESS (1 << 1) /* Drop Reasong Group for 574 Aggregate Egress 575 Flowtracker Type. */ 576 577 #ifndef BCM_HIDE_DISPATCHABLE 578 579 /* Create Flowtracker drop reasons group. */ 580 extern int bcm_flowtracker_drop_reason_group_create( 581 int unit, 582 uint32 flags, 583 bcm_flowtracker_drop_reasons_t drop_reasons, 584 bcm_flowtracker_drop_reason_group_t *id); 585 586 /* Get Flowtracker drop reasons from a group. */ 587 extern int bcm_flowtracker_drop_reason_group_get( 588 int unit, 589 bcm_flowtracker_drop_reason_group_t id, 590 bcm_flowtracker_drop_reasons_t *drop_reasons); 591 592 /* Delete Flowtracker drop reason group. */ 593 extern int bcm_flowtracker_drop_reason_group_delete( 594 int unit, 595 bcm_flowtracker_drop_reason_group_t id); 596 597 #endif /* BCM_HIDE_DISPATCHABLE */ 598 599 /* Flowtracker export trigger types */ 600 typedef enum bcm_flowtracker_export_trigger_e { 601 bcmFlowtrackerExportTriggerNone = 0, /* No export trigger. */ 602 bcmFlowtrackerExportTriggerTimer = 1, /* Flow data will be exported to 603 collector every 604 bcm_flowtracker_export_trigger_info_t.interval_usecs. */ 605 bcmFlowtrackerExportTriggerNewLearn = 2, /* Flow data will be exported to 606 collector everytime a new flow is 607 learnt in the group. */ 608 bcmFlowtrackerExportTriggerAgeOut = 3, /* Flow data will be exported to 609 collector everytime a flow ages out 610 in the group. */ 611 bcmFlowtrackerExportTriggerDrop = 4, /* Drop reason on a flow has changed. */ 612 bcmFlowtrackerExportTriggerCongestion = 5, /* Queue Congestion Monitor on a flow. */ 613 bcmFlowtrackerExportTriggerCount = 6 /* Last Value. Not Usable. */ 614 } bcm_flowtracker_export_trigger_t; 615 616 /* Flowtracker export trigger flags. */ 617 #define BCM_FLOWTRACKER_EXPORT_TRIGGER_LEARN_GUARANTEE (1 << 0) /* This flag is 618 applicable when 619 bcmFlowtrackerExportTriggerNewLearn 620 is set. When it is 621 set, 622 newly learned records 623 are always exported. 624 If it is not possible 625 to export the record, 626 flow is 627 not learned in the 628 hardware. */ 629 #define BCM_FLOWTRACKER_EXPORT_TRIGGER_AGEOUT_GUARANTEE (1 << 1) /* This flag is 630 applicable when 631 bcmFlowtrackerExportTriggerNewLearn 632 is set. When it is 633 set, 634 aged out records are 635 always exported. */ 636 637 /* Flowtracker export trigger information. */ 638 typedef struct bcm_flowtracker_export_trigger_info_s { 639 SHR_BITDCL trigger_bmp[_SHR_BITDCLSIZE(bcmFlowtrackerExportTriggerCount)]; /* The bitmap of export triggers which 640 will result in the export of the 641 IPFIX packets. */ 642 uint32 interval_usecs; /* If one of the export triggers is 643 bcmFlowtrackerExportTriggerTimer, 644 this provides the interval for the 645 timer. */ 646 uint32 flags; /* Flag to export triggers. */ 647 } bcm_flowtracker_export_trigger_info_t; 648 649 /* Manipulate the export trigger bitmap. */ 650 #define BCM_FLOWTRACKER_TRIGGER_SET(_export_info, _trigger) SHR_BITSET(((_export_info).trigger_bmp), (_trigger)) 651 #define BCM_FLOWTRACKER_TRIGGER_GET(_export_info, _trigger) SHR_BITGET(((_export_info).trigger_bmp), (_trigger)) 652 #define BCM_FLOWTRACKER_TRIGGER_CLEAR(_export_info, _trigger) SHR_BITCLR(((_export_info).trigger_bmp), (_trigger)) 653 #define BCM_FLOWTRACKER_TRIGGER_CLEAR_ALL(_export_info) SHR_BITCLR_RANGE(((_export_info).trigger_bmp), 0, bcmFlowtrackerExportTriggerCount) 654 655 /* 656 * Macros for bcm_flowtracker_collector_eth_header_t.vlan_tag_structure 657 * to indicate the tag structure of vlans. 658 */ 659 #define BCM_FLOWTRACKER_COLLECTOR_ETH_HDR_UNTAGGED 0x1 660 #define BCM_FLOWTRACKER_COLLECTOR_ETH_HDR_SINGLE_TAGGED 0x2 661 #define BCM_FLOWTRACKER_COLLECTOR_ETH_HDR_DOUBLE_TAGGED 0x3 662 663 /* 664 * Ethernet header in the encap used to send the IPFIX packet to the 665 * collector. 666 */ 667 typedef struct bcm_flowtracker_collector_eth_header_s { 668 bcm_mac_t dst_mac; 669 bcm_mac_t src_mac; 670 uint8 vlan_tag_structure; 671 uint16 outer_tpid; 672 uint16 inner_tpid; 673 bcm_vlan_tag_t outer_vlan_tag; 674 bcm_vlan_tag_t inner_vlan_tag; 675 } bcm_flowtracker_collector_eth_header_t; 676 677 /* 678 * IPv4 header in the encap used to send the IPFIX packet to the 679 * collector. 680 */ 681 typedef struct bcm_flowtracker_collector_ipv4_header_s { 682 bcm_ip_t src_ip; 683 bcm_ip_t dst_ip; 684 uint8 dscp; 685 uint8 ttl; 686 } bcm_flowtracker_collector_ipv4_header_t; 687 688 /* 689 * IPv6 header in the encap used to send the IPFIX packet to the 690 * collector. 691 */ 692 typedef struct bcm_flowtracker_collector_ipv6_header_s { 693 bcm_ip6_t src_ip; 694 bcm_ip6_t dst_ip; 695 uint8 traffic_class; 696 uint32 flow_label; 697 uint8 hop_limit; 698 } bcm_flowtracker_collector_ipv6_header_t; 699 700 /* 701 * UDP header in the encap used to send the IPFIX packet to the 702 * collector. 703 */ 704 typedef struct bcm_flowtracker_collector_udp_header_s { 705 bcm_l4_port_t src_port; 706 bcm_l4_port_t dst_port; 707 } bcm_flowtracker_collector_udp_header_t; 708 709 /* Software ID given for a Flowtracker collector configuration. */ 710 typedef int bcm_flowtracker_collector_t; 711 712 /* 713 * Transport types that are supported for exporting flow data to the 714 * collector 715 */ 716 typedef enum bcm_flowtracker_collector_transport_type_e { 717 bcmFlowtrackerCollectorTransportTypeIpfixIpv4Udp = 0, /* The encap will be of the format UDP 718 over IPv4. */ 719 bcmFlowtrackerCollectorTransportTypeIpfixIpv6Udp = 1, /* The encap will be of the format UDP 720 over IPv6. */ 721 bcmFlowtrackerCollectorTransportTypeRaw = 2, /* Indicates no encap. This will be 722 useful when the raw IPFIX PDUs need 723 to be transported to the local CPU. */ 724 bcmFlowtrackerCollectorTransportTypeCount = 3 /* Last Value. Not Usable. */ 725 } bcm_flowtracker_collector_transport_type_t; 726 727 /* Flowtracker Collector types. */ 728 typedef enum bcm_flowtracker_collector_type_e { 729 bcmFlowtrackerCollectorRemote = 0, /* The collector is a remote machine 730 expecting flow information records 731 using encap scheme defined through 732 TransportTypeXxx. */ 733 bcmFlowtrackerCollectorLocal = 1, /* The collector is local CPU receiving 734 flow information records usually 735 without any encap. TransportTypeRaw. */ 736 bcmFlowtrackerCollectorCount = 2 /* Last Value. Not Usable. */ 737 } bcm_flowtracker_collector_type_t; 738 739 /* Flowtracker collector information. */ 740 typedef struct bcm_flowtracker_collector_info_s { 741 bcm_flowtracker_collector_type_t collector_type; /* Flowtracker Collector type. Remote vs 742 Local */ 743 bcm_flowtracker_collector_transport_type_t transport_type; /* Transport type used for exporting 744 flow data to the collector. This 745 identifies the usable fields within 746 the encap structure member defined 747 below. */ 748 bcm_flowtracker_collector_eth_header_t eth; /* Ethernet encapsulation of the packet 749 sent to collector. */ 750 bcm_flowtracker_collector_ipv4_header_t ipv4; /* IPv4 encapsulation of the packet sent 751 to collector. */ 752 bcm_flowtracker_collector_ipv6_header_t ipv6; /* IPv6 encapsulation of the packet sent 753 to collector. */ 754 bcm_flowtracker_collector_udp_header_t udp; /* UDP encapsulation of the packet sent 755 to collector. */ 756 uint16 max_packet_length; /* The maximum packet length of an 757 export packet that can be sent to 758 this collector. */ 759 bcm_flowtracker_timestamp_source_t src_ts; /* Timestamp source info. */ 760 } bcm_flowtracker_collector_info_t; 761 762 /* Software ID given for a Flowtracker flow group configuration. */ 763 typedef int bcm_flowtracker_group_t; 764 765 /* Flow check object. */ 766 typedef uint32 bcm_flowtracker_check_t; 767 768 /* 769 * Flags (bcm_flowtracker_group_info_t.flags) to be used with group 770 * during group create. 771 */ 772 #define BCM_FLOWTRACKER_GROUP_USER_ENTRIES_ONLY (1 << 0) /* Group supports user 773 added flow entries 774 only. */ 775 776 /* Default Group. */ 777 #define BCM_FLOWTRACKER_GROUP_DEFAULT (1 << 1) /* Indicates that this is a 778 default group. */ 779 780 /* Custom key length. */ 781 #define BCM_FLOWTRACKER_CUSTOM_KEY_MAX_LENGTH 16 /* Maximum length of 782 custom key */ 783 784 /* Flowtracker Group Types */ 785 typedef enum bcm_flowtracker_group_type_e { 786 bcmFlowtrackerGroupTypeNone = 0, /* Default Flowtracker Group */ 787 bcmFlowtrackerGroupTypeAggregateIngress = 1, /* Aggregate Ingress Flowtracker Group 788 type. */ 789 bcmFlowtrackerGroupTypeAggregateMmu = 2, /* Aggregate Mmu Flowtracker Group Type. */ 790 bcmFlowtrackerGroupTypeAggregateEgress = 3, /* Aggregate Egress Flowtracker Group 791 Type. */ 792 bcmFlowtrackerGroupTypeCount = 4 /* Last Value. Not Usable. */ 793 } bcm_flowtracker_group_type_t; 794 795 /* Flowtracker flow group information. */ 796 typedef struct bcm_flowtracker_group_info_s { 797 bcm_flowtracker_ipfix_observation_domain_t observation_domain_id; /* IPFIX observation domain to which 798 this flow group belongs to. */ 799 int group_class; /* Flowtracker flow group Class id. */ 800 uint32 group_flags; /* Flowtracker flow group flags. See 801 BCM_FLOWTRACKER_GROUP_XXX. */ 802 bcm_flowtracker_group_type_t group_type; /* Flowtracker flow group type. See 803 bcm_flowtracker_group_type_t. */ 804 bcm_field_group_t field_group[BCM_PIPES_MAX]; /* Field group corresponding to the flow 805 group. */ 806 } bcm_flowtracker_group_info_t; 807 808 #define BCM_FLOWTRACKER_GROUP_TYPE_SHIFT (24) 809 810 #define BCM_FLOWTRACKER_GROUP_TYPE_MASK (0xFF) 811 812 #define BCM_FLOWTRACKER_GROUP_IDX_MASK ((1 << BCM_FLOWTRACKER_GROUP_TYPE_SHIFT) - 1) 813 814 #define BCM_FLOWTRACKER_GROUP_ID_SET(group_id, group_type, group_index) \ 815 (group_id) = ((((group_type) & BCM_FLOWTRACKER_GROUP_TYPE_MASK) << \ 816 (BCM_FLOWTRACKER_GROUP_TYPE_SHIFT)) | \ 817 ((group_index) & BCM_FLOWTRACKER_GROUP_IDX_MASK)) 818 819 #define BCM_FLOWTRACKER_GROUP_INDEX_GET(group_id) \ 820 ((group_id) & (BCM_FLOWTRACKER_GROUP_IDX_MASK)) 821 822 #define BCM_FLOWTRACKER_GROUP_TYPE_GET(group_id) \ 823 (((group_id) >> BCM_FLOWTRACKER_GROUP_TYPE_SHIFT) & BCM_FLOWTRACKER_GROUP_TYPE_MASK) 824 825 /* 826 * Five tuple can be outer/inner SRC IP, DST IP, L4 SRC PORT, L4 DST PORT 827 * and IP PROTOCOL that constitutes a flow. 828 */ 829 typedef struct bcm_flowtracker_flow_key_s { 830 bcm_ip_addr_t src_ip; 831 bcm_ip_addr_t dst_ip; 832 bcm_l4_port_t l4_src_port; 833 bcm_l4_port_t l4_dst_port; 834 uint8 ip_protocol; 835 bcm_ip_addr_t inner_src_ip; 836 bcm_ip_addr_t inner_dst_ip; 837 bcm_l4_port_t inner_l4_src_port; 838 bcm_l4_port_t inner_l4_dst_port; 839 uint8 inner_ip_protocol; 840 uint32 vxlan_network_id; 841 uint8 custom[BCM_FLOWTRACKER_CUSTOM_KEY_MAX_LENGTH]; 842 bcm_port_t in_port; 843 } bcm_flowtracker_flow_key_t; 844 845 /* Flowtracker flow group flow level data. */ 846 typedef struct bcm_flowtracker_flow_data_s { 847 uint64 packet_count; 848 uint64 byte_count; 849 uint64 flow_start_timestamp_msecs; 850 uint64 observation_timestamp_msecs; 851 bcm_rx_reasons_t pkt_drop_reasons; 852 uint8 is_static; 853 } bcm_flowtracker_flow_data_t; 854 855 /* Flowtracker Flow direction Types. */ 856 typedef enum bcm_flowtracker_direction_e { 857 bcmFlowtrackerFlowDirectionNone = 0, /* No Direction. */ 858 bcmFlowtrackerFlowDirectionForward = 1, /* The flow is tracked in forward 859 direction only. Flow direciton is 860 forward from server to client flow. */ 861 bcmFlowtrackerFlowDirectionReverse = 2, /* The flow is tracked in reverse 862 direction only. Flow direciton is 863 reverse from client to server flow. */ 864 bcmFlowtrackerFlowDirectionBidirectional = 3, /* The flow is tracked in both the 865 forward and reverse directions. */ 866 bcmFlowtrackerFlowDirectionCount = 4 /* Last Value. Not Usable. */ 867 } bcm_flowtracker_direction_t; 868 869 /* Software ID given for a Flowtracker export template configuration. */ 870 typedef int bcm_flowtracker_export_template_t; 871 872 /* Flowtracker export element flags. */ 873 #define BCM_FLOWTRACKER_EXPORT_ELEMENT_FLAGS_ENTERPRISE (1 << 0) /* Indicates that the 874 element is an 875 enterprise specific 876 element */ 877 #define BCM_FLOWTRACKER_EXPORT_ELEMENT_FLAGS_STICKYOR_UPDATE (1 << 1) /* Indicates that the 878 element is a sticky 879 element */ 880 881 /* The different export element types that constitute an template. */ 882 typedef enum bcm_flowtracker_export_element_type_e { 883 bcmFlowtrackerExportElementTypeSrcIPv4 = 0, 884 bcmFlowtrackerExportElementTypeDstIPv4 = 1, 885 bcmFlowtrackerExportElementTypeSrcIPv6 = 2, 886 bcmFlowtrackerExportElementTypeDstIPv6 = 3, 887 bcmFlowtrackerExportElementTypeL4SrcPort = 4, 888 bcmFlowtrackerExportElementTypeL4DstPort = 5, 889 bcmFlowtrackerExportElementTypeIPProtocol = 6, 890 bcmFlowtrackerExportElementTypePktCount = 7, 891 bcmFlowtrackerExportElementTypeByteCount = 8, 892 bcmFlowtrackerExportElementTypePktDeltaCount = 9, 893 bcmFlowtrackerExportElementTypeByteDeltaCount = 10, 894 bcmFlowtrackerExportElementTypeVRF = 11, 895 bcmFlowtrackerExportElementTypeObservationTimeMsecs = 12, 896 bcmFlowtrackerExportElementTypeFlowStartTimeMsecs = 13, 897 bcmFlowtrackerExportElementTypeFlowtrackerGroup = 14, 898 bcmFlowtrackerExportElementTypeReserved = 15, 899 bcmFlowtrackerExportElementTypeTTL = 16, 900 bcmFlowtrackerExportElementTypeIPLength = 17, 901 bcmFlowtrackerExportElementTypeTcpWindowSize = 18, 902 bcmFlowtrackerExportElementTypeDosAttack = 19, 903 bcmFlowtrackerExportElementTypeVxlanNetworkId = 20, 904 bcmFlowtrackerExportElementTypeNextHeader = 21, 905 bcmFlowtrackerExportElementTypeHopLimit = 22, 906 bcmFlowtrackerExportElementTypeInnerSrcIPv4 = 23, 907 bcmFlowtrackerExportElementTypeInnerDstIPv4 = 24, 908 bcmFlowtrackerExportElementTypeInnerSrcIPv6 = 25, 909 bcmFlowtrackerExportElementTypeInnerDstIPv6 = 26, 910 bcmFlowtrackerExportElementTypeInnerIPProtocol = 27, 911 bcmFlowtrackerExportElementTypeInnerTTL = 28, 912 bcmFlowtrackerExportElementTypeInnerNextHeader = 29, 913 bcmFlowtrackerExportElementTypeInnerHopLimit = 30, 914 bcmFlowtrackerExportElementTypeInnerL4SrcPort = 31, 915 bcmFlowtrackerExportElementTypeInnerL4DstPort = 32, 916 bcmFlowtrackerExportElementTypeExportReasons = 33, 917 bcmFlowtrackerExportElementTypeExportFlags = 34, 918 bcmFlowtrackerExportElementTypeTcpFlags = 35, 919 bcmFlowtrackerExportElementTypeOuterVlanTag = 36, 920 bcmFlowtrackerExportElementTypeIP6Length = 37, 921 bcmFlowtrackerExportElementTypeInnerIPLength = 38, 922 bcmFlowtrackerExportElementTypeInnerIP6Length = 39, 923 bcmFlowtrackerExportElementTypeTimestampNewLearn = 40, 924 bcmFlowtrackerExportElementTypeTimestampFlowStart = 41, 925 bcmFlowtrackerExportElementTypeTimestampFlowEnd = 42, 926 bcmFlowtrackerExportElementTypeTimestampCheckEvent1 = 43, 927 bcmFlowtrackerExportElementTypeTimestampCheckEvent2 = 44, 928 bcmFlowtrackerExportElementTypeInnerDosAttack = 45, 929 bcmFlowtrackerExportElementTypeTunnelClass = 46, 930 bcmFlowtrackerExportElementTypeFlowtrackerCheck = 47, 931 bcmFlowtrackerExportElementTypeCustom = 48, 932 bcmFlowtrackerExportElementTypeFlowViewID = 49, 933 bcmFlowtrackerExportElementTypeFlowViewSampleCount = 50, 934 bcmFlowtrackerExportElementTypeFlowCount = 51, 935 bcmFlowtrackerExportElementTypeDropPktCount = 52, 936 bcmFlowtrackerExportElementTypeDropByteCount = 53, 937 bcmFlowtrackerExportElementTypeEgrPort = 54, 938 bcmFlowtrackerExportElementTypeQueueID = 55, 939 bcmFlowtrackerExportElementTypeQueueBufferUsage = 56, 940 bcmFlowtrackerExportElementTypeChipDelay = 57, 941 bcmFlowtrackerExportElementTypeE2EDelay = 58, 942 bcmFlowtrackerExportElementTypeIPATDelay = 59, 943 bcmFlowtrackerExportElementTypeIPDTDelay = 60, 944 bcmFlowtrackerExportElementTypeIngPortPGMinCongestionLevel = 61, 945 bcmFlowtrackerExportElementTypeIngPortPGSharedCongestionLevel = 62, 946 bcmFlowtrackerExportElementTypeIngPortPoolMinCongestionLevel = 63, 947 bcmFlowtrackerExportElementTypeIngPortPoolSharedCongestionLevel = 64, 948 bcmFlowtrackerExportElementTypeIngPoolSharedCongestionLevel = 65, 949 bcmFlowtrackerExportElementTypeIngPortPGHeadroomCongestionLevel = 66, 950 bcmFlowtrackerExportElementTypeIngPortPoolHeadroomCongestionLevel = 67, 951 bcmFlowtrackerExportElementTypeIngGlobalHeadroomCongestionLevel = 68, 952 bcmFlowtrackerExportElementTypeEgrPoolSharedCongestionLevel = 69, 953 bcmFlowtrackerExportElementTypeEgrQueueMinCongestionLevel = 70, 954 bcmFlowtrackerExportElementTypeEgrQueueSharedCongestionLevel = 71, 955 bcmFlowtrackerExportElementTypeEgrQueueGroupMinCongestionLevel = 72, 956 bcmFlowtrackerExportElementTypeEgrQueueGroupSharedCongestionLevel = 73, 957 bcmFlowtrackerExportElementTypeEgrPortPoolSharedCongestionLevel = 74, 958 bcmFlowtrackerExportElementTypeEgrRQEPoolSharedCongestionLevel = 75, 959 bcmFlowtrackerExportElementTypeCFAPCongestionLevel = 76, 960 bcmFlowtrackerExportElementTypeMMUCongestionLevel = 77, 961 bcmFlowtrackerExportElementTypeMMUQueueId = 78, 962 bcmFlowtrackerExportElementTypeECMPGroupIdLevel1 = 79, 963 bcmFlowtrackerExportElementTypeECMPGroupIdLevel2 = 80, 964 bcmFlowtrackerExportElementTypeTrunkMemberId = 81, 965 bcmFlowtrackerExportElementTypeTrunkGroupId = 82, 966 bcmFlowtrackerExportElementTypeIngPort = 83, 967 bcmFlowtrackerExportElementTypeIngDropReasonGroupIdVector = 84, 968 bcmFlowtrackerExportElementTypeNextHopB = 85, 969 bcmFlowtrackerExportElementTypeNextHopA = 86, 970 bcmFlowtrackerExportElementTypeIPPayloadLength = 87, 971 bcmFlowtrackerExportElementTypeQosAttr = 88, 972 bcmFlowtrackerExportElementTypeMMUCos = 89, 973 bcmFlowtrackerExportElementTypeEgrDropReasonGroupIdVector = 90, 974 bcmFlowtrackerExportElementTypeTimestampCheckEvent3 = 91, 975 bcmFlowtrackerExportElementTypeTimestampCheckEvent4 = 92, 976 bcmFlowtrackerExportElementTypeQueueRxPktCount = 93, 977 bcmFlowtrackerExportElementTypeFlowIdentifier = 94, 978 bcmFlowtrackerExportElementTypeMMUQueueGroupId = 95, 979 bcmFlowtrackerExportElementTypeMMUPacketTos = 96, 980 bcmFlowtrackerExportElementTypeEgrPacketTos = 97, 981 bcmFlowtrackerExportElementTypeQueueRxByteCount = 98, 982 bcmFlowtrackerExportElementTypeIPVersion = 99, 983 bcmFlowtrackerExportElementTypeBufferUsage = 100, 984 bcmFlowtrackerExportElementTypeIngPacketTos = 101, 985 bcmFlowtrackerExportElementTypeL2ForwardingField = 102, 986 bcmFlowtrackerExportElementTypeInnerTcpFlags = 103, 987 bcmFlowtrackerExportElementTypeGbpSrcId = 104, 988 bcmFlowtrackerExportElementTypeTimestampIngress = 105, 989 bcmFlowtrackerExportElementTypeTimestampEgress = 106, 990 bcmFlowtrackerExportElementTypeEgrClassId = 107, 991 bcmFlowtrackerExportElementTypeTcpSeqNumber = 108, 992 bcmFlowtrackerExportElementTypeCount = 109 993 } bcm_flowtracker_export_element_type_t; 994 995 /* The different tracking parameters that can be tracked in flowtracker. */ 996 typedef enum bcm_flowtracker_tracking_param_type_e { 997 bcmFlowtrackerTrackingParamTypeNone = 0, 998 bcmFlowtrackerTrackingParamTypeSrcIPv4 = 1, 999 bcmFlowtrackerTrackingParamTypeDstIPv4 = 2, 1000 bcmFlowtrackerTrackingParamTypeSrcIPv6 = 3, 1001 bcmFlowtrackerTrackingParamTypeDstIPv6 = 4, 1002 bcmFlowtrackerTrackingParamTypeL4SrcPort = 5, 1003 bcmFlowtrackerTrackingParamTypeL4DstPort = 6, 1004 bcmFlowtrackerTrackingParamTypeIPProtocol = 7, 1005 bcmFlowtrackerTrackingParamTypePktCount = 8, 1006 bcmFlowtrackerTrackingParamTypeByteCount = 9, 1007 bcmFlowtrackerTrackingParamTypeVRF = 10, 1008 bcmFlowtrackerTrackingParamTypeTTL = 11, 1009 bcmFlowtrackerTrackingParamTypeIPLength = 12, 1010 bcmFlowtrackerTrackingParamTypeTcpWindowSize = 13, 1011 bcmFlowtrackerTrackingParamTypeDosAttack = 14, 1012 bcmFlowtrackerTrackingParamTypeVxlanNetworkId = 15, 1013 bcmFlowtrackerTrackingParamTypeNextHeader = 16, 1014 bcmFlowtrackerTrackingParamTypeHopLimit = 17, 1015 bcmFlowtrackerTrackingParamTypeInnerSrcIPv4 = 18, 1016 bcmFlowtrackerTrackingParamTypeInnerDstIPv4 = 19, 1017 bcmFlowtrackerTrackingParamTypeInnerSrcIPv6 = 20, 1018 bcmFlowtrackerTrackingParamTypeInnerDstIPv6 = 21, 1019 bcmFlowtrackerTrackingParamTypeInnerIPProtocol = 22, 1020 bcmFlowtrackerTrackingParamTypeInnerTTL = 23, 1021 bcmFlowtrackerTrackingParamTypeInnerNextHeader = 24, 1022 bcmFlowtrackerTrackingParamTypeInnerHopLimit = 25, 1023 bcmFlowtrackerTrackingParamTypeInnerL4SrcPort = 26, 1024 bcmFlowtrackerTrackingParamTypeInnerL4DstPort = 27, 1025 bcmFlowtrackerTrackingParamTypeTcpFlags = 28, 1026 bcmFlowtrackerTrackingParamTypeOuterVlanTag = 29, 1027 bcmFlowtrackerTrackingParamTypeIP6Length = 30, 1028 bcmFlowtrackerTrackingParamTypeInnerIPLength = 31, 1029 bcmFlowtrackerTrackingParamTypeInnerIP6Length = 32, 1030 bcmFlowtrackerTrackingParamTypeTimestampNewLearn = 33, 1031 bcmFlowtrackerTrackingParamTypeTimestampFlowStart = 34, 1032 bcmFlowtrackerTrackingParamTypeTimestampFlowEnd = 35, 1033 bcmFlowtrackerTrackingParamTypeTimestampCheckEvent1 = 36, 1034 bcmFlowtrackerTrackingParamTypeTimestampCheckEvent2 = 37, 1035 bcmFlowtrackerTrackingParamTypeInnerDosAttack = 38, 1036 bcmFlowtrackerTrackingParamTypeTunnelClass = 39, 1037 bcmFlowtrackerTrackingParamTypeFlowtrackerCheck = 40, 1038 bcmFlowtrackerTrackingParamTypeCustom = 41, 1039 bcmFlowtrackerTrackingParamTypeIngPort = 42, 1040 bcmFlowtrackerTrackingParamTypeChipDelay = 43, 1041 bcmFlowtrackerTrackingParamTypeE2EDelay = 44, 1042 bcmFlowtrackerTrackingParamTypeIPATDelay = 45, 1043 bcmFlowtrackerTrackingParamTypeIPDTDelay = 46, 1044 bcmFlowtrackerTrackingParamTypeIngPortPGMinCongestionLevel = 47, 1045 bcmFlowtrackerTrackingParamTypeIngPortPGSharedCongestionLevel = 48, 1046 bcmFlowtrackerTrackingParamTypeIngPortPoolMinCongestionLevel = 49, 1047 bcmFlowtrackerTrackingParamTypeIngPortPoolSharedCongestionLevel = 50, 1048 bcmFlowtrackerTrackingParamTypeIngPoolSharedCongestionLevel = 51, 1049 bcmFlowtrackerTrackingParamTypeIngPortPGHeadroomCongestionLevel = 52, 1050 bcmFlowtrackerTrackingParamTypeIngPortPoolHeadroomCongestionLevel = 53, 1051 bcmFlowtrackerTrackingParamTypeIngGlobalHeadroomCongestionLevel = 54, 1052 bcmFlowtrackerTrackingParamTypeEgrPoolSharedCongestionLevel = 55, 1053 bcmFlowtrackerTrackingParamTypeEgrQueueMinCongestionLevel = 56, 1054 bcmFlowtrackerTrackingParamTypeEgrQueueSharedCongestionLevel = 57, 1055 bcmFlowtrackerTrackingParamTypeEgrQueueGroupMinCongestionLevel = 58, 1056 bcmFlowtrackerTrackingParamTypeEgrQueueGroupSharedCongestionLevel = 59, 1057 bcmFlowtrackerTrackingParamTypeEgrPortPoolSharedCongestionLevel = 60, 1058 bcmFlowtrackerTrackingParamTypeEgrRQEPoolSharedCongestionLevel = 61, 1059 bcmFlowtrackerTrackingParamTypeCFAPCongestionLevel = 62, 1060 bcmFlowtrackerTrackingParamTypeMMUCongestionLevel = 63, 1061 bcmFlowtrackerTrackingParamTypeMMUQueueId = 64, 1062 bcmFlowtrackerTrackingParamTypeECMPGroupIdLevel1 = 65, 1063 bcmFlowtrackerTrackingParamTypeECMPGroupIdLevel2 = 66, 1064 bcmFlowtrackerTrackingParamTypeTrunkMemberId = 67, 1065 bcmFlowtrackerTrackingParamTypeTrunkGroupId = 68, 1066 bcmFlowtrackerTrackingParamTypeIngDropReasonGroupIdVector = 69, 1067 bcmFlowtrackerTrackingParamTypeNextHopB = 70, 1068 bcmFlowtrackerTrackingParamTypeNextHopA = 71, 1069 bcmFlowtrackerTrackingParamTypeIPPayloadLength = 72, 1070 bcmFlowtrackerTrackingParamTypeQosAttr = 73, 1071 bcmFlowtrackerTrackingParamTypeEgrPort = 74, 1072 bcmFlowtrackerTrackingParamTypeMMUCos = 75, 1073 bcmFlowtrackerTrackingParamTypeEgrDropReasonGroupIdVector = 76, 1074 bcmFlowtrackerTrackingParamTypeTimestampCheckEvent3 = 77, 1075 bcmFlowtrackerTrackingParamTypeTimestampCheckEvent4 = 78, 1076 bcmFlowtrackerTrackingParamTypeIngressDelay = 79, 1077 bcmFlowtrackerTrackingParamTypeEgressDelay = 80, 1078 bcmFlowtrackerTrackingParamTypeMMUQueueGroupId = 81, 1079 bcmFlowtrackerTrackingParamTypeMMUPacketTos = 82, 1080 bcmFlowtrackerTrackingParamTypeEgrPacketTos = 83, 1081 bcmFlowtrackerTrackingParamTypeIngPacketTos = 84, 1082 bcmFlowtrackerTrackingParamTypeL2ForwardingField = 85, 1083 bcmFlowtrackerTrackingParamTypeInnerTcpFlags = 86, 1084 bcmFlowtrackerTrackingParamTypeGbpSrcId = 87, 1085 bcmFlowtrackerTrackingParamTypeTimestampIngress = 88, 1086 bcmFlowtrackerTrackingParamTypeTimestampEgress = 89, 1087 bcmFlowtrackerTrackingParamTypeEgrClassId = 90, 1088 bcmFlowtrackerTrackingParamTypeTcpSeqNumber = 91, 1089 bcmFlowtrackerTrackingParamTypeCount = 92 1090 } bcm_flowtracker_tracking_param_type_t; 1091 1092 #define BCM_FT_TRACKING_PARAM_STRINGS \ 1093 { \ 1094 "None", \ 1095 "SrcIPv4", \ 1096 "DstIPv4", \ 1097 "SrcIPv6", \ 1098 "DstIPv6", \ 1099 "L4SrcPort", \ 1100 "L4DstPort", \ 1101 "IPProtocol", \ 1102 "PktCount", \ 1103 "ByteCount", \ 1104 "VRF", \ 1105 "TTL", \ 1106 "IPLength", \ 1107 "TcpWindowSize", \ 1108 "DosAttack", \ 1109 "VxlanNetworkId", \ 1110 "NextHeader", \ 1111 "HopLimit", \ 1112 "InnerSrcIPv4", \ 1113 "InnerDstIPv4", \ 1114 "InnerSrcIPv6", \ 1115 "InnerDstIPv6", \ 1116 "InnerIPProtocol", \ 1117 "InnerTTL", \ 1118 "InnerNextHeader", \ 1119 "InnerHopLimit", \ 1120 "InnerL4SrcPort", \ 1121 "InnerL4DstPort", \ 1122 "TcpFlags", \ 1123 "OuterVlanTag", \ 1124 "IP6Length", \ 1125 "InnerIPLength", \ 1126 "InnerIP6Length", \ 1127 "TimestampNewLearn", \ 1128 "TimestampFlowStart", \ 1129 "TimestampFlowEnd", \ 1130 "TimestampCheckEvent1", \ 1131 "TimestampCheckEvent2", \ 1132 "InnerDosAttack", \ 1133 "TunnelClass", \ 1134 "FlowtrackerCheck", \ 1135 "Custom", \ 1136 "IngPort", \ 1137 "ChipDelay", \ 1138 "E2EDelay", \ 1139 "IPATDelay", \ 1140 "IPDTDelay", \ 1141 "IngPortPGMinCongestionLevel", \ 1142 "IngPortPGSharedCongestionLevel", \ 1143 "IngPortPoolMinCongestionLevel", \ 1144 "IngPortPoolSharedCongestionLevel", \ 1145 "IngPoolSharedCongestionLevel", \ 1146 "IngPortPGHeadroomCongestionLevel", \ 1147 "IngPortPoolHeadroomCongestionLevel", \ 1148 "IngGlobalHeadroomCongestionLevel", \ 1149 "EgrPoolSharedCongestionLevel", \ 1150 "EgrQueueMinCongestionLevel", \ 1151 "EgrQueueSharedCongestionLevel", \ 1152 "EgrQueueGroupMinCongestionLevel", \ 1153 "EgrQueueGroupSharedCongestionLevel", \ 1154 "EgrPortPoolSharedCongestionLevel", \ 1155 "EgrRQEPoolSharedCongestionLevel", \ 1156 "CFAPCongestionLevel", \ 1157 "MMUCongestionLevel", \ 1158 "MMUQueueId", \ 1159 "ECMPGroupIdLevel1", \ 1160 "ECMPGroupIdLevel2", \ 1161 "TrunkMemberId", \ 1162 "TrunkGroupId", \ 1163 "IngDropReasonGroupIdVector", \ 1164 "NextHopB", \ 1165 "NextHopA", \ 1166 "IPPayloadLength", \ 1167 "QosAttr", \ 1168 "EgrPort", \ 1169 "MMUCos", \ 1170 "EgrDropReasonGroupIdVector", \ 1171 "TimestampCheckEvent3", \ 1172 "TimestampCheckEvent4", \ 1173 "IngressDelay", \ 1174 "EgressDelay", \ 1175 "MMUQueueGroupId", \ 1176 "MMUPacketTos", \ 1177 "EgrPacketTos", \ 1178 "IngPacketTos", \ 1179 "L2ForwardingField", \ 1180 "InnerTcpFlags", \ 1181 "GbpSrcId", \ 1182 "TimestampIngress", \ 1183 "TimestampEgress", \ 1184 "EgrClassId", \ 1185 "TcpSeqNumber", \ 1186 "Count" \ 1187 } 1188 1189 /* Flowtracker export template elements information. */ 1190 typedef struct bcm_flowtracker_export_element_info_s { 1191 uint32 flags; /* See 1192 BCM_FLOWTRACKER_EXPORT_ELEMENT_FLAGS_XXX. */ 1193 bcm_flowtracker_export_element_type_t element; /* Type of export element. */ 1194 uint32 data_size; /* Size of information element in the 1195 export record in bytes. If the 1196 data_size is given as 0, then the 1197 default RFC size is used. */ 1198 uint16 info_elem_id; /* Information element to be used, when 1199 the template set is exported. */ 1200 bcm_flowtracker_check_t check_id; /* Flowtracker Check Id for exporting 1201 check data. */ 1202 bcm_flowtracker_direction_t direction; /* Direction of exporting data element. */ 1203 uint16 custom_id; /* Custom Identifier for Flowtracker 1204 Export Element type custom. */ 1205 } bcm_flowtracker_export_element_info_t; 1206 1207 /* Flowtracker template set transmit configuration. */ 1208 typedef struct bcm_flowtracker_template_transmit_config_s { 1209 int retransmit_interval_secs; /* Interval in seconds at which the template 1210 set has to be transmitted. */ 1211 int initial_burst; /* Number of times the template set needs to 1212 be sent before settling to a periodic 1213 export. */ 1214 } bcm_flowtracker_template_transmit_config_t; 1215 1216 /* 1217 * Flowtracker information for checker to compute time delay between 1218 * various packet events across pipeline. 1219 */ 1220 typedef struct bcm_flowtracker_check_delay_info_s { 1221 bcm_flowtracker_timestamp_source_t src_ts; /* Timestamp source info. */ 1222 bcm_flowtracker_timestamp_source_t dst_ts; /* Timestamp destination info. */ 1223 uint8 gran; /* Delay granularity which defines 1224 number of shifts for delay operands. */ 1225 int offset; /* Offset added to delay result in 1226 nanoseconds. */ 1227 } bcm_flowtracker_check_delay_info_t; 1228 1229 #ifndef BCM_HIDE_DISPATCHABLE 1230 1231 /* Initialize flowtracker subsystem. */ 1232 extern int bcm_flowtracker_init( 1233 int unit); 1234 1235 /* Detach flowtracker subsystem. */ 1236 extern int bcm_flowtracker_detach( 1237 int unit); 1238 1239 #endif /* BCM_HIDE_DISPATCHABLE */ 1240 1241 /* 1242 * Options that can be passed via options parameter during export 1243 * template creation. 1244 */ 1245 #define BCM_FLOWTRACKER_EXPORT_TEMPLATE_WITH_ID (1 << 0) /* Create an export 1246 template with ID. */ 1247 1248 #ifndef BCM_HIDE_DISPATCHABLE 1249 1250 /* Validate the template and return the list supported by the device. */ 1251 extern int bcm_flowtracker_export_template_validate( 1252 int unit, 1253 bcm_flowtracker_group_t flow_group_id, 1254 int max_in_export_elements, 1255 bcm_flowtracker_export_element_info_t *in_export_elements, 1256 int max_out_export_elements, 1257 bcm_flowtracker_export_element_info_t *out_export_elements, 1258 int *actual_out_export_elements); 1259 1260 /* Create a flowtracker export template. */ 1261 extern int bcm_flowtracker_export_template_create( 1262 int unit, 1263 uint32 options, 1264 bcm_flowtracker_export_template_t *id, 1265 uint16 set_id, 1266 int num_export_elements, 1267 bcm_flowtracker_export_element_info_t *list_of_export_elements); 1268 1269 /* Get a flowtracker export template. */ 1270 extern int bcm_flowtracker_export_template_get( 1271 int unit, 1272 bcm_flowtracker_export_template_t id, 1273 uint16 *set_id, 1274 int max_size, 1275 bcm_flowtracker_export_element_info_t *list_of_export_elements, 1276 int *list_size); 1277 1278 #endif /* BCM_HIDE_DISPATCHABLE */ 1279 1280 /* Initialize flowtracker template transmit configuration. */ 1281 extern void bcm_flowtracker_template_transmit_config_t_init( 1282 bcm_flowtracker_template_transmit_config_t *config); 1283 1284 #ifndef BCM_HIDE_DISPATCHABLE 1285 1286 /* Destroy a flowtracker export template. */ 1287 extern int bcm_flowtracker_export_template_destroy( 1288 int unit, 1289 bcm_flowtracker_export_template_t id); 1290 1291 /* Set the template transmit configuration. */ 1292 extern int bcm_flowtracker_template_transmit_config_set( 1293 int unit, 1294 bcm_flowtracker_export_template_t template_id, 1295 bcm_collector_t collector_id, 1296 bcm_flowtracker_template_transmit_config_t *config); 1297 1298 /* Set the template transmit configuration. */ 1299 extern int bcm_flowtracker_template_transmit_config_get( 1300 int unit, 1301 bcm_flowtracker_export_template_t template_id, 1302 bcm_collector_t collector_id, 1303 bcm_flowtracker_template_transmit_config_t *config); 1304 1305 #endif /* BCM_HIDE_DISPATCHABLE */ 1306 1307 /* Initialize a collector information structure. */ 1308 extern void bcm_flowtracker_collector_info_t_init( 1309 bcm_flowtracker_collector_info_t *collector_info); 1310 1311 /* 1312 * Options that can be passed via options parameter during collector 1313 * creation. 1314 */ 1315 #define BCM_FLOWTRACKER_COLLECTOR_WITH_ID (1 << 0) /* Create a collector 1316 with ID. */ 1317 #define BCM_FLOWTRACKER_COLLECTOR_REPLACE (1 << 1) /* Replace a collector 1318 with ID. */ 1319 1320 #ifndef BCM_HIDE_DISPATCHABLE 1321 1322 /* Create a flowtracker collector. */ 1323 extern int bcm_flowtracker_collector_create( 1324 int unit, 1325 uint32 options, 1326 bcm_flowtracker_collector_t *collector_id, 1327 bcm_flowtracker_collector_info_t *collector_info); 1328 1329 /* Get a flowtracker collector. */ 1330 extern int bcm_flowtracker_collector_get( 1331 int unit, 1332 bcm_flowtracker_collector_t id, 1333 bcm_flowtracker_collector_info_t *collector_info); 1334 1335 /* Get all the configured flowtracker collectors. */ 1336 extern int bcm_flowtracker_collector_get_all( 1337 int unit, 1338 int max_size, 1339 bcm_flowtracker_collector_t *collector_list, 1340 int *list_size); 1341 1342 /* Destroy a flowtracker collector. */ 1343 extern int bcm_flowtracker_collector_destroy( 1344 int unit, 1345 bcm_flowtracker_collector_t id); 1346 1347 #endif /* BCM_HIDE_DISPATCHABLE */ 1348 1349 /* Initialize a flow group information structure. */ 1350 extern void bcm_flowtracker_group_info_t_init( 1351 bcm_flowtracker_group_info_t *flow_group_info); 1352 1353 /* 1354 * Options that can be passed via options parameter during flow group 1355 * creation. 1356 */ 1357 #define BCM_FLOWTRACKER_GROUP_WITH_ID (1 << 0) /* Create a flow group with 1358 ID. */ 1359 #define BCM_FLOWTRACKER_GROUP_REPLACE (1 << 1) /* Replace a flow group with 1360 ID. */ 1361 1362 #ifndef BCM_HIDE_DISPATCHABLE 1363 1364 /* Create a flowtracker flow group. */ 1365 extern int bcm_flowtracker_group_create( 1366 int unit, 1367 uint32 options, 1368 bcm_flowtracker_group_t *flow_group_id, 1369 bcm_flowtracker_group_info_t *flow_group_info); 1370 1371 /* Get a flowtracker flow group. */ 1372 extern int bcm_flowtracker_group_get( 1373 int unit, 1374 bcm_flowtracker_group_t id, 1375 bcm_flowtracker_group_info_t *flow_group_info); 1376 1377 /* Get all the configured flowtracker flow group IDs. */ 1378 extern int bcm_flowtracker_group_get_all( 1379 int unit, 1380 int max_size, 1381 bcm_flowtracker_group_t *flow_group_list, 1382 int *list_size); 1383 1384 /* Set flow limit on the flow group with ID. */ 1385 extern int bcm_flowtracker_group_flow_limit_set( 1386 int unit, 1387 bcm_flowtracker_group_t id, 1388 uint32 flow_limit); 1389 1390 /* Get flow limit set on the flow group with ID. */ 1391 extern int bcm_flowtracker_group_flow_limit_get( 1392 int unit, 1393 bcm_flowtracker_group_t id, 1394 uint32 *flow_limit); 1395 1396 /* Set stat mode id to provided flow tracker group. */ 1397 extern int bcm_flowtracker_group_stat_modeid_set( 1398 int unit, 1399 bcm_flowtracker_group_t id, 1400 uint32 stat_modeid); 1401 1402 /* Get stat modeid attached to provided flow tracker group. */ 1403 extern int bcm_flowtracker_group_stat_modeid_get( 1404 int unit, 1405 bcm_flowtracker_group_t id, 1406 uint32 *stat_modeid); 1407 1408 /* Set aging timer interval in ms on the flow group with ID */ 1409 extern int bcm_flowtracker_group_age_timer_set( 1410 int unit, 1411 bcm_flowtracker_group_t id, 1412 uint32 aging_interval_ms); 1413 1414 /* Get aging timer interval in ms set on the flow group with ID */ 1415 extern int bcm_flowtracker_group_age_timer_get( 1416 int unit, 1417 bcm_flowtracker_group_t id, 1418 uint32 *aging_interval_ms); 1419 1420 #endif /* BCM_HIDE_DISPATCHABLE */ 1421 1422 /* Initialize a export trigger information structure. */ 1423 extern void bcm_flowtracker_export_trigger_info_t_init( 1424 bcm_flowtracker_export_trigger_info_t *info); 1425 1426 #ifndef BCM_HIDE_DISPATCHABLE 1427 1428 /* Set flow group's export triggers. */ 1429 extern int bcm_flowtracker_group_export_trigger_set( 1430 int unit, 1431 bcm_flowtracker_group_t id, 1432 bcm_flowtracker_export_trigger_info_t *export_trigger_info); 1433 1434 /* Get flow group's export triggers. */ 1435 extern int bcm_flowtracker_group_export_trigger_get( 1436 int unit, 1437 bcm_flowtracker_group_t id, 1438 bcm_flowtracker_export_trigger_info_t *export_trigger_info); 1439 1440 /* Get number of flows learnt on this flow group with ID. */ 1441 extern int bcm_flowtracker_group_flow_count_get( 1442 int unit, 1443 bcm_flowtracker_group_t id, 1444 uint32 *flow_count); 1445 1446 /* Destroy the flow group with ID. */ 1447 extern int bcm_flowtracker_group_destroy( 1448 int unit, 1449 bcm_flowtracker_group_t id); 1450 1451 #endif /* BCM_HIDE_DISPATCHABLE */ 1452 1453 /* 1454 * Flags that can be passed via flags parameter during flow group clear 1455 * operation. 1456 */ 1457 #define BCM_FLOWTRACKER_GROUP_CLEAR_ALL (1 << 0) /* Clear entire flow 1458 group flow entries(key 1459 and data). */ 1460 #define BCM_FLOWTRACKER_GROUP_CLEAR_FLOW_DATA_ONLY (1 << 1) /* Clear only data of the 1461 flow group flow 1462 entries. */ 1463 1464 #ifndef BCM_HIDE_DISPATCHABLE 1465 1466 /* Clear information associated with a flow group */ 1467 extern int bcm_flowtracker_group_clear( 1468 int unit, 1469 bcm_flowtracker_group_t id, 1470 uint32 flags); 1471 1472 /* Associate flow group to a collector with an export template. */ 1473 extern int bcm_flowtracker_group_collector_add( 1474 int unit, 1475 bcm_flowtracker_group_t flow_group_id, 1476 bcm_flowtracker_collector_t collector_id, 1477 bcm_flowtracker_export_template_t template_id); 1478 1479 /* Dis Associate flow group from a collector with an export template. */ 1480 extern int bcm_flowtracker_group_collector_delete( 1481 int unit, 1482 bcm_flowtracker_group_t flow_group_id, 1483 bcm_flowtracker_collector_t collector_id, 1484 bcm_flowtracker_export_template_t template_id); 1485 1486 /* 1487 * Get the list of associated collectors and export templates for the 1488 * flow group. 1489 */ 1490 extern int bcm_flowtracker_group_collector_get_all( 1491 int unit, 1492 bcm_flowtracker_group_t flow_group_id, 1493 int max_list_size, 1494 bcm_flowtracker_collector_t *list_of_collectors, 1495 bcm_flowtracker_export_template_t *list_of_templates, 1496 int *list_size); 1497 1498 /* 1499 * Associate flow group to a collector with an export template and 1500 * profile. 1501 */ 1502 extern int bcm_flowtracker_group_collector_attach( 1503 int unit, 1504 bcm_flowtracker_group_t flow_group_id, 1505 bcm_collector_t collector_id, 1506 int export_profile_id, 1507 bcm_flowtracker_export_template_t template_id); 1508 1509 /* Dis Associate flow group from a collector with an export template. */ 1510 extern int bcm_flowtracker_group_collector_detach( 1511 int unit, 1512 bcm_flowtracker_group_t flow_group_id, 1513 bcm_collector_t collector_id, 1514 int export_profile_id, 1515 bcm_flowtracker_export_template_t template_id); 1516 1517 /* 1518 * Get the list of associated collectors and export templates for the 1519 * flow group. 1520 */ 1521 extern int bcm_flowtracker_group_collector_attach_get_all( 1522 int unit, 1523 bcm_flowtracker_group_t flow_group_id, 1524 int max_list_size, 1525 bcm_collector_t *list_of_collectors, 1526 bcm_flowtracker_export_template_t *list_of_templates, 1527 int *export_profile_id_list, 1528 int *list_size); 1529 1530 #endif /* BCM_HIDE_DISPATCHABLE */ 1531 1532 /* Initialize flow key */ 1533 extern void bcm_flowtracker_flow_key_t_init( 1534 bcm_flowtracker_flow_key_t *flow_key); 1535 1536 #ifndef BCM_HIDE_DISPATCHABLE 1537 1538 /* Given a flow key, get the associated data */ 1539 extern int bcm_flowtracker_group_data_get( 1540 int unit, 1541 bcm_flowtracker_group_t flow_group_id, 1542 bcm_flowtracker_flow_key_t *flow_key, 1543 bcm_flowtracker_flow_data_t *flow_data); 1544 1545 #endif /* BCM_HIDE_DISPATCHABLE */ 1546 1547 /* State Transition flags. */ 1548 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_CLOSED_SYN (1 << 0) /* State Transition for 1549 TCP from CLOSED on TCP 1550 Flag SYN. */ 1551 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_CLOSED_SYNACK (1 << 1) /* State Transition for 1552 TCP from CLOSED on TCP 1553 Flag SYN+ACK. */ 1554 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_SYNWAIT_ACK (1 << 2) /* State Transition for 1555 TCP from SYNWAIT on 1556 TCP Flag ACK. */ 1557 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_SYNWAIT_FIN (1 << 3) /* State Transition for 1558 TCP from SYNWAIT on 1559 TCP Flag FIN. */ 1560 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_SYNWAIT_RST (1 << 4) /* State Transition for 1561 TCP from SYNWAIT on 1562 TCP Flag RST. */ 1563 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_ESTABLISHED_FIN (1 << 5) /* State Transition for 1564 TCP from ESTABLISHED 1565 on TCP Flag FIN. */ 1566 #define BCM_FLOWTRACKER_STATE_TRANSITION_TCP_ESTABLISHED_RST (1 << 6) /* State Transition for 1567 TCP from ESTABLISHED 1568 on TCP Flag RST. */ 1569 1570 /* Flow check operation types */ 1571 typedef enum bcm_flowtracker_check_operation_e { 1572 bcmFlowtrackerCheckOpNone = 0, /* No operation for check. */ 1573 bcmFlowtrackerCheckOpEqual = 1, /* The packet attribute value should be 1574 equal to minimum value. */ 1575 bcmFlowtrackerCheckOpNotEqual = 2, /* The packet attribute value should not 1576 be equal to minimum value. */ 1577 bcmFlowtrackerCheckOpSmaller = 3, /* The packet attribute value should be 1578 smaller than the maximum value. */ 1579 bcmFlowtrackerCheckOpSmallerEqual = 4, /* The packet attribute value should be 1580 smaller or equal to the maximum 1581 value. */ 1582 bcmFlowtrackerCheckOpGreater = 5, /* The packet attribute value should be 1583 greater than minimum value. */ 1584 bcmFlowtrackerCheckOpGreaterEqual = 6, /* The packet attribute value should be 1585 greater than or equal to minimum 1586 value. */ 1587 bcmFlowtrackerCheckOpPass = 7, /* The check will always pass. */ 1588 bcmFlowtrackerCheckOpFail = 8, /* The Check will always fail. */ 1589 bcmFlowtrackerCheckOpInRange = 9, /* The packet attribute value should be 1590 in Range of minimum and maximum 1591 values. Both values are inclusive. */ 1592 bcmFlowtrackerCheckOpOutofRange = 10, /* The packet attribute value should be 1593 out of Range of minimum and maximum 1594 values. Both values are inclusive. */ 1595 bcmFlowtrackerCheckOpMask = 11, /* Bitwise AND of packet attribute with 1596 maximum value as mask and then do 1597 bitwise OR of resultant value. */ 1598 bcmFlowtrackerCheckOpCount = 12 /* Last Value. Total number of all 1599 operations. */ 1600 } bcm_flowtracker_check_operation_t; 1601 1602 #define BCM_FT_CHECK_OPERATION_STRINGS \ 1603 { \ 1604 "None", \ 1605 "Equal", \ 1606 "NotEqual", \ 1607 "Smaller", \ 1608 "SmallerEqual", \ 1609 "Greater", \ 1610 "GreaterEqual", \ 1611 "Pass", \ 1612 "Fail", \ 1613 "InRange", \ 1614 "OutofRange", \ 1615 "Mask", \ 1616 "Count" \ 1617 } 1618 1619 /* Flags for flowtracker check creation. */ 1620 #define BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT1 (1 << 0) /* Enable trigger for 1621 check's first event. */ 1622 #define BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT2 (1 << 1) /* Enable trigger for 1623 check's second event. */ 1624 #define BCM_FLOWTRACKER_CHECK_DATA_CLEAR_ON_EXPORT (1 << 2) /* Clear data associated 1625 with this check during 1626 export. */ 1627 #define BCM_FLOWTRACKER_CHECK_EXPORT_MODE_THRESHOLD (1 << 3) /* if set, compare if 1628 check's updated data 1629 is greater-equal to 1630 threshold and old data 1631 is less than threshold 1632 for export check else 1633 compare ALU new data 1634 to old session data 1635 and perform export 1636 check. */ 1637 #define BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT3 (1 << 4) /* Enable trigger for 1638 check's third event. */ 1639 #define BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT4 (1 << 5) /* Enable trigger for 1640 check's fourth event. */ 1641 #define BCM_FLOWTRACKER_CHECK_DATA_CLEAR_ON_PERIODIC_EXPORT (1 << 6) /* Clear session data 1642 after periodic export. */ 1643 #define BCM_FLOWTRACKER_CHECK_UNICAST_FLOW_ONLY (1 << 7) /* Check operates on 1644 Unicast flows only */ 1645 #define BCM_FLOWTRACKER_CHECK_MULTICAST_FLOW_ONLY (1 << 8) /* Check operates on 1646 multicast flows only */ 1647 #define BCM_FLOWTRACKER_CHECK_MODE_32BIT (1 << 9) /* Check operating mode 1648 is 32 bits */ 1649 #define BCM_FLOWTRACKER_CHECK_MODE_16BIT (1 << 10) /* Check operating mode 1650 is 16 bits */ 1651 1652 /* Flowtracker check information. */ 1653 typedef struct bcm_flowtracker_check_info_s { 1654 uint32 flags; /* Configuration flags for Check 1655 Creation. */ 1656 bcm_flowtracker_tracking_param_type_t param; /* The attribute of flow on which the 1657 check is performed. */ 1658 uint32 min_value; /* Element value to do greater than or 1659 equal checks. Minimum value to do 1660 range checks. */ 1661 uint32 max_value; /* Element value to do smaller than or 1662 mask checks. Maximum value to do 1663 range checks. */ 1664 uint32 mask_value; /* Mask value to be applied on flow 1665 attribute. */ 1666 uint8 shift_value; /* Right shift value to be applied on 1667 flow attribute. */ 1668 bcm_flowtracker_check_operation_t operation; /* Operation to be performed for this 1669 check. */ 1670 bcm_flowtracker_check_t primary_check_id; /* primary check id to associate second 1671 check for aggregated checks on same 1672 flow. */ 1673 uint32 state_transition_flags; /* State Transition flags */ 1674 uint16 num_drop_reason_group_id; /* Number of drop reason group id. */ 1675 bcm_flowtracker_drop_reason_group_t drop_reason_group_id[BCM_FLOWTRACKER_DROP_REASON_GROUP_ID_MAX]; /* Flowtracker drop reason group ids. 1676 Applicable only if tracking param is 1677 IngDropReasonGroupIdVector or 1678 EgrDropReasonGroupIdVector. */ 1679 uint16 custom_id; /* Custom Identifier for Flowtracker 1680 Tracking parameter type custom. */ 1681 } bcm_flowtracker_check_info_t; 1682 1683 /* Flow check Action types */ 1684 typedef enum bcm_flowtracker_check_action_e { 1685 bcmFlowtrackerCheckActionNone = 0, /* No action. */ 1686 bcmFlowtrackerCheckActionCounterIncr = 1, /* Increment the Counter stored in 1687 tracking data table by 1. */ 1688 bcmFlowtrackerCheckActionCounterIncrByValue = 2, /* Increment the attribute value stored 1689 in tracking data with the packet's 1690 attribute value. */ 1691 bcmFlowtrackerCheckActionUpdateLowerValue = 3, /* Compare packet's attribute value with 1692 tracking data value and if lower, 1693 replace tracking data value with 1694 packets attribute value. */ 1695 bcmFlowtrackerCheckActionUpdateHigherValue = 4, /* Compare packet's attribute value with 1696 tracking data value and if higher, 1697 replace tracking data value with 1698 packets attribute value. */ 1699 bcmFlowtrackerCheckActionUpdateValue = 5, /* Replace packet's attribute value with 1700 the tracking data value. */ 1701 bcmFlowtrackerCheckActionUpdateAverageValue = 6, /* Update tracking data with the 1702 Avergare of packet's attribute value 1703 and tracking data value */ 1704 bcmFlowtrackerCheckActionCounterIncrByPktBytes = 7, /* Increment the Counter attached to 1705 this tracking data by number of bytes 1706 in the packet. */ 1707 bcmFlowtrackerCheckActionCount = 8 /* Last Value. Count of Flow check 1708 Actions */ 1709 } bcm_flowtracker_check_action_t; 1710 1711 #define BCM_FT_CHECK_ACTION_STRINGS \ 1712 { \ 1713 "None", \ 1714 "CounterIncr", \ 1715 "CounterIncrByValue", \ 1716 "UpdateLowerValue", \ 1717 "UpdateHigherValue", \ 1718 "UpdateValue", \ 1719 "UpdateAverageValue", \ 1720 "CounterIncrByPktBytes", \ 1721 "Count" \ 1722 } 1723 1724 /* Initialize a flow check information structure. */ 1725 extern void bcm_flowtracker_check_info_t_init( 1726 bcm_flowtracker_check_info_t *check_info); 1727 1728 /* 1729 * Options that can be passed via options parameter during flow check 1730 * creation. 1731 */ 1732 #define BCM_FLOWTRACKER_CHECK_WITH_ID (1 << 0) /* Create a flow check with 1733 ID. */ 1734 #define BCM_FLOWTRACKER_CHECK_SECOND (1 << 1) /* Create a secondary check 1735 on existing check. */ 1736 1737 #ifndef BCM_HIDE_DISPATCHABLE 1738 1739 /* Create a flowtracker flow group. */ 1740 extern int bcm_flowtracker_check_create( 1741 int unit, 1742 uint32 options, 1743 bcm_flowtracker_check_info_t check_info, 1744 bcm_flowtracker_check_t *check_id); 1745 1746 /* Destroy a flowtracker flow check. */ 1747 extern int bcm_flowtracker_check_destroy( 1748 int unit, 1749 bcm_flowtracker_check_t check_id); 1750 1751 /* Get a flowtracker flow check. */ 1752 extern int bcm_flowtracker_check_get( 1753 int unit, 1754 bcm_flowtracker_check_t check_id, 1755 bcm_flowtracker_check_info_t *check_info); 1756 1757 /* Destroys all flowtracker flow checks. */ 1758 extern int bcm_flowtracker_check_destroy_all( 1759 int unit); 1760 1761 #endif /* BCM_HIDE_DISPATCHABLE */ 1762 1763 /* User callback for flow check traverse routine. */ 1764 typedef int(*bcm_flowtracker_check_traverse_cb)( 1765 int unit, 1766 bcm_flowtracker_check_t check_id, 1767 bcm_flowtracker_check_info_t *check_info, 1768 void *user_data); 1769 1770 #ifndef BCM_HIDE_DISPATCHABLE 1771 1772 /* Destroys all flowtracker flow checks. */ 1773 extern int bcm_flowtracker_check_traverse( 1774 int unit, 1775 bcm_flowtracker_check_traverse_cb cb, 1776 void *user_data); 1777 1778 #endif /* BCM_HIDE_DISPATCHABLE */ 1779 1780 /* Percent weightage assigned to tracking param for running average */ 1781 typedef enum bcm_flowtracker_tracking_param_weight_e { 1782 bcmFlowtrackerTrackingParamWeight0 = 0, /* 0 percent Weight assigned to tracking 1783 param. */ 1784 bcmFlowtrackerTrackingParamWeight4 = 4, /* 4 percent Weight assigned to tracking 1785 param. */ 1786 bcmFlowtrackerTrackingParamWeight8 = 8, /* 8 percent Weight assigned to tracking 1787 param. */ 1788 bcmFlowtrackerTrackingParamWeight12 = 12, /* 12 percent Weight assigned to 1789 tracking param. */ 1790 bcmFlowtrackerTrackingParamWeight14 = 14, /* 14 percent Weight assigned to 1791 tracking param. */ 1792 bcmFlowtrackerTrackingParamWeight16 = 16, /* 16 percent Weight assigned to 1793 tracking param. */ 1794 bcmFlowtrackerTrackingParamWeight19 = 19, /* 19 percent Weight assigned to 1795 tracking param. */ 1796 bcmFlowtrackerTrackingParamWeight22 = 22, /* 22 percent Weight assigned to 1797 tracking param. */ 1798 bcmFlowtrackerTrackingParamWeight25 = 25, /* 25 percent Weight assigned to 1799 tracking param. */ 1800 bcmFlowtrackerTrackingParamWeight29 = 29, /* 29 percent Weight assigned to 1801 tracking param. */ 1802 bcmFlowtrackerTrackingParamWeight33 = 33, /* 33 percent Weight assigned to 1803 tracking param. */ 1804 bcmFlowtrackerTrackingParamWeight37 = 37, /* 37 percent Weight assigned to 1805 tracking param. */ 1806 bcmFlowtrackerTrackingParamWeight41 = 41, /* 41 percent Weight assigned to 1807 tracking param. */ 1808 bcmFlowtrackerTrackingParamWeight44 = 44, /* 44 percent Weight assigned to 1809 tracking param. */ 1810 bcmFlowtrackerTrackingParamWeight47 = 47, /* 47 percent Weight assigned to 1811 tracking param. */ 1812 bcmFlowtrackerTrackingParamWeight50 = 50, /* 50 percent Weight assigned to 1813 tracking param. */ 1814 bcmFlowtrackerTrackingParamWeight53 = 53, /* 53 percent Weight assigned to 1815 tracking param. */ 1816 bcmFlowtrackerTrackingParamWeight56 = 56, /* 56 percent Weight assigned to 1817 tracking param. */ 1818 bcmFlowtrackerTrackingParamWeight59 = 59, /* 59 percent Weight assigned to 1819 tracking param. */ 1820 bcmFlowtrackerTrackingParamWeight63 = 63, /* 63 percent Weight assigned to 1821 tracking param. */ 1822 bcmFlowtrackerTrackingParamWeight67 = 67, /* 67 percent Weight assigned to 1823 tracking param. */ 1824 bcmFlowtrackerTrackingParamWeight71 = 71, /* 71 percent Weight assigned to 1825 tracking param. */ 1826 bcmFlowtrackerTrackingParamWeight75 = 75, /* 75 percent Weight assigned to 1827 tracking param. */ 1828 bcmFlowtrackerTrackingParamWeight78 = 78, /* 78 percent Weight assigned to 1829 tracking param. */ 1830 bcmFlowtrackerTrackingParamWeight81 = 81, /* 81 percent Weight assigned to 1831 tracking param. */ 1832 bcmFlowtrackerTrackingParamWeight84 = 84, /* 84 percent Weight assigned to 1833 tracking param. */ 1834 bcmFlowtrackerTrackingParamWeight86 = 86, /* 86 percent Weight assigned to 1835 tracking param. */ 1836 bcmFlowtrackerTrackingParamWeight88 = 88, /* 88 percent Weight assigned to 1837 tracking param. */ 1838 bcmFlowtrackerTrackingParamWeight92 = 92, /* 92 percent Weight assigned to 1839 tracking param. */ 1840 bcmFlowtrackerTrackingParamWeight96 = 96, /* 96 percent Weight assigned to 1841 tracking param. */ 1842 bcmFlowtrackerTrackingParamWeight100 = 100 /* 100 percent Weight assigned to 1843 tracking param. */ 1844 } bcm_flowtracker_tracking_param_weight_t; 1845 1846 /* Actions related information for Flow check. */ 1847 typedef struct bcm_flowtracker_check_action_info_s { 1848 uint32 flags; /* Action flags. */ 1849 bcm_flowtracker_tracking_param_type_t param; /* The attribute of flow on which the 1850 check is performed. */ 1851 bcm_flowtracker_check_action_t action; /* Action to be performed if check 1852 passes. */ 1853 uint32 mask_value; /* Mask value to be applied on flow 1854 attribute. */ 1855 uint8 shift_value; /* Right shift value to be applied on 1856 flow attribute. */ 1857 bcm_flowtracker_tracking_param_weight_t weight; /* Weight given to current data over 1858 running average. */ 1859 bcm_flowtracker_direction_t direction; /* Direction of flow from where tracking 1860 paramter is picked. */ 1861 uint16 custom_id; /* Custom Identifier for Flowtracker 1862 Tracking parameter type custom. */ 1863 } bcm_flowtracker_check_action_info_t; 1864 1865 /* Initialize a flow check action information structure. */ 1866 extern void bcm_flowtracker_check_action_info_t_init( 1867 bcm_flowtracker_check_action_info_t *info); 1868 1869 #ifndef BCM_HIDE_DISPATCHABLE 1870 1871 /* Initialize a flow check action information structure. */ 1872 extern int bcm_flowtracker_check_action_info_set( 1873 int unit, 1874 bcm_flowtracker_check_t check_id, 1875 bcm_flowtracker_check_action_info_t info); 1876 1877 /* Initialize a flow check action information structure. */ 1878 extern int bcm_flowtracker_check_action_info_get( 1879 int unit, 1880 bcm_flowtracker_check_t check_id, 1881 bcm_flowtracker_check_action_info_t *info); 1882 1883 #endif /* BCM_HIDE_DISPATCHABLE */ 1884 1885 /* Export related information for Flow check. */ 1886 typedef struct bcm_flowtracker_check_export_info_s { 1887 uint32 export_check_threshold; /* Threshold at which the export should 1888 be triggered for this check. At each 1889 incoming matching flow's packet the 1890 tracking data is updated and that 1891 value is checked with threshold 1892 value. If the check mentioned by 1893 operation passes between two values 1894 then export is triggered. */ 1895 bcm_flowtracker_check_operation_t operation; /* Operation to be checked with 1896 threshold value for export check. */ 1897 } bcm_flowtracker_check_export_info_t; 1898 1899 /* Initialize a flow check export information structure. */ 1900 extern void bcm_flowtracker_check_export_info_t_init( 1901 bcm_flowtracker_check_export_info_t *info); 1902 1903 #ifndef BCM_HIDE_DISPATCHABLE 1904 1905 /* Set flow check export information to flowtracker check. */ 1906 extern int bcm_flowtracker_check_export_info_set( 1907 int unit, 1908 bcm_flowtracker_check_t check_id, 1909 bcm_flowtracker_check_export_info_t info); 1910 1911 /* Get flow check export information for a flowtracker check. */ 1912 extern int bcm_flowtracker_check_export_info_get( 1913 int unit, 1914 bcm_flowtracker_check_t check_id, 1915 bcm_flowtracker_check_export_info_t *info); 1916 1917 #endif /* BCM_HIDE_DISPATCHABLE */ 1918 1919 /* Initialize a flow check delay information structure. */ 1920 extern void bcm_flowtracker_check_delay_info_t_init( 1921 bcm_flowtracker_check_delay_info_t *info); 1922 1923 #ifndef BCM_HIDE_DISPATCHABLE 1924 1925 /* Set a flow check delay information to a flowtracker check. */ 1926 extern int bcm_flowtracker_check_delay_info_set( 1927 int unit, 1928 bcm_flowtracker_check_t check_id, 1929 bcm_flowtracker_check_delay_info_t info); 1930 1931 /* Get a flow check delay information structure. */ 1932 extern int bcm_flowtracker_check_delay_info_get( 1933 int unit, 1934 bcm_flowtracker_check_t check_id, 1935 bcm_flowtracker_check_delay_info_t *info); 1936 1937 /* Add a flow check into flow group. */ 1938 extern int bcm_flowtracker_group_check_add( 1939 int unit, 1940 bcm_flowtracker_group_t group_id, 1941 bcm_flowtracker_check_t check_id); 1942 1943 /* Delete a flow check into flow group. */ 1944 extern int bcm_flowtracker_group_check_delete( 1945 int unit, 1946 bcm_flowtracker_group_t group_id, 1947 bcm_flowtracker_check_t check_id); 1948 1949 /* Get all the flow checks associated with flow group. */ 1950 extern int bcm_flowtracker_group_check_get_all( 1951 int unit, 1952 bcm_flowtracker_group_t group_id, 1953 int max_checks, 1954 bcm_flowtracker_check_t *list_of_check_ids, 1955 int *num_checks); 1956 1957 #endif /* BCM_HIDE_DISPATCHABLE */ 1958 1959 /* Collector Copy Flags. */ 1960 #define BCM_FLOWTRACKER_COLLECTOR_COPY_SAMPLE_RANDOM 0x00000001 /* This flag is used to 1961 select the random 1962 number out of 1963 num_pkts_skip_for_next_sample 1964 for random sampling of 1965 packet. If this flag 1966 is not used then 1967 num_pkts_skip_for_next_sample 1968 is used as sampling 1969 interval. */ 1970 1971 /* Flowtracker Collector copy info. */ 1972 typedef struct bcm_flowtracker_collector_copy_info_s { 1973 uint32 flags; /* Flags for Collector copy information */ 1974 uint32 num_pkts_initial_samples; /* Number of initial sample copies to 1975 be sent to collector */ 1976 uint32 num_pkts_skip_for_next_sample; /* Number of packets to skip to send 1977 next sample copy to collector. */ 1978 } bcm_flowtracker_collector_copy_info_t; 1979 1980 /* Initialize a flow group collector copy information structure. */ 1981 extern void bcm_flowtracker_collector_copy_info_t_init( 1982 bcm_flowtracker_collector_copy_info_t *info); 1983 1984 #ifndef BCM_HIDE_DISPATCHABLE 1985 1986 /* Set flow group's collector copy information. */ 1987 extern int bcm_flowtracker_group_collector_copy_info_set( 1988 int unit, 1989 bcm_flowtracker_group_t group_id, 1990 bcm_flowtracker_collector_copy_info_t info); 1991 1992 /* Get flow group's collector copy information. */ 1993 extern int bcm_flowtracker_group_collector_copy_info_get( 1994 int unit, 1995 bcm_flowtracker_group_t group_id, 1996 bcm_flowtracker_collector_copy_info_t *info); 1997 1998 #endif /* BCM_HIDE_DISPATCHABLE */ 1999 2000 /* Configuration flags for flowtracker groups's meter. */ 2001 #define BCM_FLOWTRACKER_METER_MODE_PACKET (1 << 0) /* Group metering mode is 2002 per packet. */ 2003 2004 /* Flowtracker meter info. */ 2005 typedef struct bcm_flowtracker_meter_info_s { 2006 uint32 flags; /* Flags for meter information */ 2007 uint32 ckbits_sec; /* Committed rate (kbits per sec). */ 2008 uint32 ckbits_burst; /* Committed burst size (kbits). */ 2009 uint32 actual_ckbits_sec; /* Granularity adjusted Committed rate (kbits 2010 per sec). */ 2011 uint32 actual_ckbits_burst; /* Granularity adjusted Committed burst size 2012 (kbits). */ 2013 } bcm_flowtracker_meter_info_t; 2014 2015 /* Initialize a flow group meter information structure. */ 2016 extern void bcm_flowtracker_meter_info_t_init( 2017 bcm_flowtracker_meter_info_t *meter_info); 2018 2019 #ifndef BCM_HIDE_DISPATCHABLE 2020 2021 /* Set flow group's metering information. */ 2022 extern int bcm_flowtracker_group_meter_info_set( 2023 int unit, 2024 bcm_flowtracker_group_t group_id, 2025 bcm_flowtracker_meter_info_t info); 2026 2027 /* Set flow group's metering information. */ 2028 extern int bcm_flowtracker_group_meter_info_get( 2029 int unit, 2030 bcm_flowtracker_group_t group_id, 2031 bcm_flowtracker_meter_info_t *info); 2032 2033 #endif /* BCM_HIDE_DISPATCHABLE */ 2034 2035 /* Flowtracker Tracking param defines. */ 2036 #define BCM_FLOWTRACKER_TRACKING_PARAM_MASK_LEN 16 /* Mask Length for 2037 highest bit length 2038 tracking parameter. */ 2039 2040 /* bcm_flowtracker_tracking_param_mask_t */ 2041 typedef uint8 bcm_flowtracker_tracking_param_mask_t[BCM_FLOWTRACKER_TRACKING_PARAM_MASK_LEN]; 2042 2043 /* bcm_flowtracker_param_user_entry_param_data_t */ 2044 typedef uint8 bcm_flowtracker_tracking_param_user_data_t[BCM_FLOWTRACKER_TRACKING_PARAM_MASK_LEN]; 2045 2046 /* 2047 * Options that can be passed via options parameter during export 2048 * template creation. 2049 */ 2050 #define BCM_FLOWTRACKER_TRACKING_PARAM_TYPE_KEY (1 << 0) /* Tracking parameter is 2051 a key. */ 2052 #define BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT1 (1 << 1) /* Tracking parameter use 2053 timestamp engine 1. */ 2054 #define BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT2 (1 << 2) /* Tracking parameter use 2055 timestamp engine 2. */ 2056 #define BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT3 (1 << 3) /* Tracking parameter use 2057 timestamp engine 3. */ 2058 #define BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT4 (1 << 4) /* Tracking parameter use 2059 timestamp engine 4. */ 2060 #define BCM_FLOWTRACKER_TRACKING_PARAM_STICKYOR_UPDATE (1 << 5) /* Tracking parameter is 2061 sticky. New value will 2062 be ORed with old value 2063 and then updated in 2064 session data. */ 2065 2066 /* Flowtracker tracking parameter information. */ 2067 typedef struct bcm_flowtracker_tracking_param_info_s { 2068 uint32 flags; /* Flags for tracking parameters. */ 2069 bcm_flowtracker_tracking_param_type_t param; /* Type of tracking parameter. */ 2070 bcm_flowtracker_tracking_param_user_data_t tracking_data; /* Element data for the tracking param 2071 to be used to add a flow. */ 2072 bcm_flowtracker_tracking_param_mask_t mask; /* Mask to select granular information 2073 from tracking parameter. By default, 2074 mask is set to all enabled. */ 2075 bcm_flowtracker_check_t check_id; /* Flowtracker check to be used to 2076 tracking flow check data. */ 2077 bcm_flowtracker_timestamp_source_t src_ts; /* Timestamp source info, valid in case 2078 of timestamp and delay related 2079 tracking params. */ 2080 bcm_udf_id_t udf_id; /* UDF Id associated with the tracking 2081 param. */ 2082 bcm_flowtracker_direction_t direction; /* Direction of flow from where tracking 2083 parameter is picked. */ 2084 uint16 custom_id; /* Custom Identifier for Flowtracker 2085 Tracking parameter type custom. */ 2086 } bcm_flowtracker_tracking_param_info_t; 2087 2088 /* Initialize flowtracker's tracking parameters information structure. */ 2089 extern void bcm_flowtracker_tracking_param_info_t_init( 2090 bcm_flowtracker_tracking_param_info_t *info); 2091 2092 #ifndef BCM_HIDE_DISPATCHABLE 2093 2094 /* Set tracking parameter for this flowtracker group. */ 2095 extern int bcm_flowtracker_group_tracking_params_set( 2096 int unit, 2097 bcm_flowtracker_group_t id, 2098 int num_tracking_params, 2099 bcm_flowtracker_tracking_param_info_t *list_of_tracking_params); 2100 2101 /* Get flowtracker tracking parameters for this group. */ 2102 extern int bcm_flowtracker_group_tracking_params_get( 2103 int unit, 2104 bcm_flowtracker_group_t id, 2105 int max_size, 2106 bcm_flowtracker_tracking_param_info_t *list_of_tracking_params, 2107 int *list_size); 2108 2109 /* Clear information associated with multiple flow groups. */ 2110 extern int bcm_flowtracker_group_multi_clear( 2111 int unit, 2112 uint32 flags, 2113 int num_groups, 2114 bcm_flowtracker_group_t *list_of_group_ids); 2115 2116 #endif /* BCM_HIDE_DISPATCHABLE */ 2117 2118 /* State transition types support for the flowtracker group */ 2119 typedef enum bcm_flowtracker_state_transition_type_e { 2120 bcmFlowtrackerStateTransitionTypeTcpControl = 0, /* Use TCP control from outer header of 2121 the packet for state transitions. */ 2122 bcmFlowtrackerStateTransitionTypeInnerTcpControl = 1, /* Use TCP control from inner header of 2123 the packet for state transition. */ 2124 bcmFlowtrackerStateTransitionTypeCount = 2 /* Last. */ 2125 } bcm_flowtracker_state_transition_type_t; 2126 2127 /* Flowtracker Group Control types */ 2128 typedef enum bcm_flowtracker_group_control_type_e { 2129 bcmFlowtrackerGroupControlNone = 0, /* No Group Control. */ 2130 bcmFlowtrackerGroupControlNewLearnEnable = 1, /* Control to Enable/disable New flow 2131 learn on this group. */ 2132 bcmFlowtrackerGroupControlFlowtrackerEnable = 2, /* Control to Enable/disable flow 2133 tracking on this group */ 2134 bcmFlowtrackerGroupControlFlowDirection = 3, /* Control to set flow direction for 2135 tracking forward/reverse flow. */ 2136 bcmFlowtrackerGroupControlUdpFlowDirection = 4, /* Control to set flow direction for 2137 tracking forward/reverse UDP flow. */ 2138 bcmFlowtrackerGroupControlStateTransitionType = 5, /* Control to set state transition type 2139 on this flowtracker group. */ 2140 bcmFlowtrackerGroupControlCount = 6 /* Total Count of Group controls. */ 2141 } bcm_flowtracker_group_control_type_t; 2142 2143 #ifndef BCM_HIDE_DISPATCHABLE 2144 2145 /* Set behavior controls of flow group. */ 2146 extern int bcm_flowtracker_group_control_set( 2147 int unit, 2148 bcm_flowtracker_group_t group_id, 2149 bcm_flowtracker_group_control_type_t type, 2150 int arg); 2151 2152 /* Get flow group's controls. */ 2153 extern int bcm_flowtracker_group_control_get( 2154 int unit, 2155 bcm_flowtracker_group_t group_id, 2156 bcm_flowtracker_group_control_type_t type, 2157 int *arg); 2158 2159 #endif /* BCM_HIDE_DISPATCHABLE */ 2160 2161 /* Flowtracker Tracking param defines. */ 2162 #define BCM_FLOWTRACKER_TRACKING_USER_ENTRY_WIDTH 48 /* Max width of 2163 flowtracker user entry 2164 key. */ 2165 2166 /* Flowtracker user entry handle information. */ 2167 typedef struct bcm_flowtracker_user_entry_handle_s { 2168 bcm_flowtracker_group_t flow_group_id; /* Flowtracker group Id. */ 2169 int flow_index; /* Flow index. */ 2170 int flow_key_mode; /* Flow Key mode. */ 2171 int flow_key_type; /* Flow Key type. */ 2172 uint8 key_data[BCM_FLOWTRACKER_TRACKING_USER_ENTRY_WIDTH]; /* Flow user entry Key. */ 2173 } bcm_flowtracker_user_entry_handle_t; 2174 2175 /* Initialize flowtracker user entry handle information structure. */ 2176 extern void bcm_flowtracker_user_entry_handle_t_init( 2177 bcm_flowtracker_user_entry_handle_t *user_entry_handle); 2178 2179 #ifndef BCM_HIDE_DISPATCHABLE 2180 2181 /* 2182 * Add a user flow entry basis user input key elements. API expects that 2183 * all tracking parametrs of type = 'KEY' in the group are specified. 2184 */ 2185 extern int bcm_flowtracker_user_entry_add( 2186 int unit, 2187 bcm_flowtracker_group_t flow_group_id, 2188 uint32 options, 2189 int num_user_entry_params, 2190 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 2191 bcm_flowtracker_user_entry_handle_t *entry_handle); 2192 2193 /* Fetch user entry info given the entry handle. */ 2194 extern int bcm_flowtracker_user_entry_get( 2195 int unit, 2196 bcm_flowtracker_user_entry_handle_t *entry_handle, 2197 int num_user_entry_params, 2198 bcm_flowtracker_tracking_param_info_t *user_entry_param_list, 2199 int *actual_user_entry_params); 2200 2201 /* Fetch all user entries added in a against a given flow group. */ 2202 extern int bcm_flowtracker_user_entry_get_all( 2203 int unit, 2204 bcm_flowtracker_group_t flow_group_id, 2205 int num_user_entry_handles, 2206 bcm_flowtracker_user_entry_handle_t *user_entry_handle_list, 2207 int *actual_user_entry_handles); 2208 2209 /* Delete user flow entry that is added earlier. */ 2210 extern int bcm_flowtracker_user_entry_delete( 2211 int unit, 2212 bcm_flowtracker_group_t flow_group_id, 2213 bcm_flowtracker_user_entry_handle_t *entry_handle); 2214 2215 /* Delete user flow entry that is added earlier. */ 2216 extern int bcm_flowtracker_user_entry_delete_all( 2217 int unit, 2218 bcm_flowtracker_group_t flow_group_id); 2219 2220 #endif /* BCM_HIDE_DISPATCHABLE */ 2221 2222 /* Stats of the Flows on the group. */ 2223 typedef struct bcm_flowtracker_group_stat_s { 2224 uint64 flow_exceeded_count; /* Count of flows not tracked in this 2225 group after maximum number of flows 2226 configured for this group are already 2227 learnt. */ 2228 uint64 flow_missed_count; /* Count of Aged out flows in the group. */ 2229 uint64 flow_aged_out_count; /* Count of flows which are Aged out in 2230 the group. */ 2231 uint64 flow_learnt_count; /* Count of flows learnt on the group. */ 2232 uint64 flow_meter_exceeded_count; /* Count of flows which exceeded the 2233 metering limits in the group. */ 2234 uint64 flow_start_count; /* Count of flows for which connection 2235 established trigger is received. */ 2236 uint64 flow_end_count; /* Count of flows for which connection 2237 closed trigger is received. */ 2238 } bcm_flowtracker_group_stat_t; 2239 2240 /* Initialize a flowtracker group statistics structure. */ 2241 extern void bcm_flowtracker_group_stat_t_init( 2242 bcm_flowtracker_group_stat_t *group_stats); 2243 2244 #ifndef BCM_HIDE_DISPATCHABLE 2245 2246 /* Get flow group's statistics. */ 2247 extern int bcm_flowtracker_group_stat_get( 2248 int unit, 2249 bcm_flowtracker_group_t group_id, 2250 bcm_flowtracker_group_stat_t *group_stats); 2251 2252 /* Set flow group's statistics. */ 2253 extern int bcm_flowtracker_group_stat_set( 2254 int unit, 2255 bcm_flowtracker_group_t group_id, 2256 bcm_flowtracker_group_stat_t *group_stats); 2257 2258 #endif /* BCM_HIDE_DISPATCHABLE */ 2259 2260 /* 2261 * Max size of the data record received at the CPU through the FIFO DMA 2262 * reception. 2263 */ 2264 #define BCM_FLOWTRACKER_EXPORT_RECORD_LENGTH 128 /* Maximum length of a 2265 data record. 1024 2266 bits. */ 2267 2268 /* 2269 * Flowtracker Export record structure. Data record info passed to 2270 * application software by SDK Software. The unprocessed data record will 2271 * be presented in network byte order. 2272 */ 2273 typedef struct bcm_flowtracker_export_record_s { 2274 int size; /* Number of valid octets in the 2275 data_record array for the device. */ 2276 uint8 data_record[BCM_FLOWTRACKER_EXPORT_RECORD_LENGTH]; /* Raw data record in network byte 2277 order. */ 2278 } bcm_flowtracker_export_record_t; 2279 2280 /* bcm_flowtracker_export_record_t_init */ 2281 extern void bcm_flowtracker_export_record_t_init( 2282 bcm_flowtracker_export_record_t *record); 2283 2284 /* 2285 * Defines for priorities of registered handlers for Flowtracker export 2286 * records. Callback handlers are always called from highest priority to 2287 * lowest priority until one of the handlers returns record_handled or 2288 * record_handled_owned. 2289 * 2290 * 2291 * When callback handling proecedure starts, a default callback handler 2292 * is installed at BCM_FLOWTRACKER_EXPORT_CB_PRIO_MIN priority that 2293 * simply discards the record. 2294 */ 2295 #define BCM_FLOWTRACKER_EXPORT_CB_PRIO_MIN ((uint8)0) 2296 #define BCM_FLOWTRACKER_EXPORT_CB_PRIO_MAX ((uint8)255) 2297 2298 /* Flowtracker Export callback options */ 2299 typedef struct bcm_flowtracker_collector_callback_options_s { 2300 int callback_prio; /* Priority of the callback function in the list. */ 2301 } bcm_flowtracker_collector_callback_options_t; 2302 2303 /* bcm_flowtracker_collector_callback_options_t_init */ 2304 extern void bcm_flowtracker_collector_callback_options_t_init( 2305 bcm_flowtracker_collector_callback_options_t *callback_options); 2306 2307 /* Return values from Flowtracker export record callout routines. */ 2308 typedef enum bcm_flowtracker_export_record_handle_e { 2309 BCM_FLOWTRACKER_EXPORT_RECORD_INVALID = 0, /* Invalid return value. */ 2310 BCM_FLOWTRACKER_EXPORT_RECORD_NOT_HANDLED = 1, /* Export record not processed. */ 2311 BCM_FLOWTRACKER_EXPORT_RECORD_HANDLED = 2, /* Export record handled, not owned. */ 2312 BCM_FLOWTRACKER_EXPORT_RECORD_HANDLED_OWNED = 3 /* Export record handled and owned. */ 2313 } bcm_flowtracker_export_record_handle_t; 2314 2315 /* Callback routine for flowtracker record exported to local collector. */ 2316 typedef bcm_flowtracker_export_record_handle_t (*bcm_flowtracker_export_record_cb_f)( 2317 int unit, 2318 bcm_flowtracker_collector_t collector_id, 2319 bcm_flowtracker_export_record_t *record, 2320 void *userdata); 2321 2322 #ifndef BCM_HIDE_DISPATCHABLE 2323 2324 /* 2325 * Register callback routine for Local collector Flowtracker record 2326 * export. 2327 */ 2328 extern int bcm_flowtracker_export_record_register( 2329 int unit, 2330 bcm_flowtracker_collector_t collector_id, 2331 bcm_flowtracker_collector_callback_options_t callback_options, 2332 bcm_flowtracker_export_record_cb_f callback_fn, 2333 void *userdata); 2334 2335 /* 2336 * Unregister callback routine for Local collector Flowtracker record 2337 * export. 2338 */ 2339 extern int bcm_flowtracker_export_record_unregister( 2340 int unit, 2341 bcm_flowtracker_collector_t collector_id, 2342 bcm_flowtracker_collector_callback_options_t callback_options, 2343 bcm_flowtracker_export_record_cb_f callback_fn); 2344 2345 #endif /* BCM_HIDE_DISPATCHABLE */ 2346 2347 /* Group actions set flags. */ 2348 #define BCM_FLOWTRACKER_GROUP_ACTIONS_SET_FLAGS_ELEPHANT_FLOWS (1 << 0) /* Actions apply to only 2349 elephant flows in the 2350 group. */ 2351 2352 /* 2353 * Packet Color, need to be specified in param0 when using 2354 * bcmFlowtrackerGroupActionXXDropPrecedence. 2355 */ 2356 #define BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_GREEN 1 2357 #define BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_YELLOW 2 2358 #define BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_RED 3 2359 2360 /* Flowtracker group action destination types */ 2361 typedef enum bcm_flowtracker_group_action_dest_type_e { 2362 bcmFlowtrackerGroupActionDestTypeL2EgrIntf = 0, /* L2 Outgoing Interface */ 2363 bcmFlowtrackerGroupActionDestTypeVp = 1, /* Virtual Port */ 2364 bcmFlowtrackerGroupActionDestTypeEcmp = 2, /* ECMP */ 2365 bcmFlowtrackerGroupActionDestTypeL3Egr = 3, /* Next Hop Index */ 2366 bcmFlowtrackerGroupActionDestTypeL2Mcast = 4, /* Layer2 Multicast */ 2367 bcmFlowtrackerGroupActionDestTypeL3Mcast = 5, /* Layer3 Multicast */ 2368 bcmFlowtrackerGroupActionDestTypeCount = 6 /* Always Last. Not a usable value */ 2369 } bcm_flowtracker_group_action_dest_type_t; 2370 2371 /* Flowtracker Group action types */ 2372 typedef enum bcm_flowtracker_group_action_e { 2373 bcmFlowtrackerGroupActionRpDropPrecedence = 0, /* Set Red Priority Drop Precedence; 2374 param0: 2375 BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_XXX.. */ 2376 bcmFlowtrackerGroupActionYpDropPrecedence = 1, /* Set Yellow Priority Drop Precedence; 2377 param0: 2378 BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_XXX.. */ 2379 bcmFlowtrackerGroupActionGpDropPrecedence = 2, /* Set Green Priority Drop Precedence; 2380 param0: 2381 BCM_FLOWTRACKER_GROUP_ACTION_PKT_COLOR_XXX.. */ 2382 bcmFlowtrackerGroupActionUcastCosQNew = 3, /* Change CoS Queue for unicast packets; 2383 param0: New CoS Queue. */ 2384 bcmFlowtrackerGroupActionMcastCosQNew = 4, /* Change CoS Queue for multicast 2385 packets; param0: New CoS Queue. */ 2386 bcmFlowtrackerGroupActionPrioIntNew = 5, /* Change internal priority; param0: New 2387 internal priority */ 2388 bcmFlowtrackerGroupActionFspReinject = 6, /* Re-inject the First Seen Packet to 2389 the specified CosQ */ 2390 bcmFlowtrackerGroupActionDropMonitor = 7, /* Monitor Dropped flows */ 2391 bcmFlowtrackerGroupActionCongestion = 8, /* Queue Congestion Monitoring report to 2392 collector */ 2393 bcmFlowtrackerGroupActionOpaqueObject = 9, /* Set the exact match opaque object 2394 value that is used to match in IFP */ 2395 bcmFlowtrackerGroupActionFlexCtrAssign = 10, /* Set the flex counter action profile */ 2396 bcmFlowtrackerGroupActionIfaInsert = 11, /* Insert IFA header (in initiator node) 2397 and metadata */ 2398 bcmFlowtrackerGroupActionIfaDelete = 12, /* Delete IFA header and metadata */ 2399 bcmFlowtrackerGroupActionVxlanGbpEnable = 13, /* Enable VXLAN Group based policy */ 2400 bcmFlowtrackerGroupActionINTResidenceTimeEnable = 14, /* Enable use of residence time in In 2401 band telemetry packets */ 2402 bcmFlowtrackerGroupActionCopyToCpu = 15, /* Copy the packet to CPU */ 2403 bcmFlowtrackerGroupActionDrop = 16, /* Drop the packet */ 2404 bcmFlowtrackerGroupActionDropCancel = 17, /* Override the drop action in another 2405 rule */ 2406 bcmFlowtrackerGroupActionRedirectPort = 18, /* Redirect packet to single port or 2407 virtual port;param0: Gport */ 2408 bcmFlowtrackerGroupActionRedirectIpmc = 19, /* Replace L3 multicast L3 & L2 bitmap; 2409 param0: IP Multicast Index. */ 2410 bcmFlowtrackerGroupActionRedirectMcast = 20, /* Replace L2 multicast dest bitmap; 2411 param0: L2 Multicast Index. */ 2412 bcmFlowtrackerGroupActionL3Switch = 21, /* L3-switch packet; param0: ECMP or 2413 next hop info. */ 2414 bcmFlowtrackerGroupActionRedirectCancel = 22, /* Override the redirect action in 2415 another rule */ 2416 bcmFlowtrackerGroupActionDestinationType = 23, /* Set destination type for the flow */ 2417 bcmFlowtrackerGroupActionFlexStateAssign = 24, /* Set flex state action profile */ 2418 bcmFlowtrackerGroupActionMirrorIndex = 25, /* Set mirror index */ 2419 bcmFlowtrackerGroupActionCount = 26 /* Always Last. Not a usable value. */ 2420 } bcm_flowtracker_group_action_t; 2421 2422 /* Flowtracker Group action params */ 2423 typedef struct bcm_flowtracker_group_action_param_s { 2424 uint32 param0; 2425 uint32 param1; 2426 } bcm_flowtracker_group_action_param_t; 2427 2428 /* Flowtracker Group action info */ 2429 typedef struct bcm_flowtracker_group_action_info_s { 2430 bcm_flowtracker_group_action_t action; /* Action */ 2431 bcm_flowtracker_group_action_param_t params; /* Action param */ 2432 } bcm_flowtracker_group_action_info_t; 2433 2434 /* Initialize a action information structure. */ 2435 extern void bcm_flowtracker_group_action_info_t_init( 2436 bcm_flowtracker_group_action_info_t *action_info); 2437 2438 #ifndef BCM_HIDE_DISPATCHABLE 2439 2440 /* Set list of actions on a flow group. */ 2441 extern int bcm_flowtracker_group_actions_set( 2442 int unit, 2443 bcm_flowtracker_group_t flow_group_id, 2444 uint32 flags, 2445 int num_actions, 2446 bcm_flowtracker_group_action_info_t *action_list); 2447 2448 /* Get list of actions applied on a flow group. */ 2449 extern int bcm_flowtracker_group_actions_get( 2450 int unit, 2451 bcm_flowtracker_group_t flow_group_id, 2452 uint32 flags, 2453 int max_actions, 2454 bcm_flowtracker_group_action_info_t *action_list, 2455 int *num_actions); 2456 2457 #endif /* BCM_HIDE_DISPATCHABLE */ 2458 2459 /* Miscellaneous Flowtracker Elephant defines. */ 2460 #define BCM_FLOWTRACKER_ELEPHANT_MAX_PROMOTION_FILTERS 2 /* Maximum number of 2461 promotion filters in 2462 an elephant profile. */ 2463 2464 /* Elephant filter flags. */ 2465 #define BCM_FLOWTRACKER_ELEPHANT_FILTER_FLAGS_INCREASING_RATE (1 << 0) /* Rate must increase on 2466 every scan */ 2467 2468 /* 2469 * Options that can be passed via options parameter during elephant 2470 * profile creation. 2471 */ 2472 #define BCM_FLOWTRACKER_ELEPHANT_PROFILE_WITH_ID (1 << 0) /* Create an elephant 2473 profile with ID. */ 2474 2475 /* Mirror on Drop class ID flag. */ 2476 #define BCM_FLOWTRACKER_EXACT_MATCH_CLASS_ID_FLOW_DROP 1 /* Exact Match flow drop 2477 indicator class ID */ 2478 2479 /* Flowtracker Elephant profile Id. */ 2480 typedef int bcm_flowtracker_elephant_profile_t; 2481 2482 /* Flowtracker Elephant filter config */ 2483 typedef struct bcm_flowtracker_elephant_filter_s { 2484 uint32 flags; /* See 2485 BCM_FLOWTRACKER_ELEPHANT_FILTER_FLAGS_XXX 2486 definitions */ 2487 uint32 monitor_interval_usecs; /* How long should the flow be monitored */ 2488 uint32 rate_low_threshold_kbits_sec; /* Minimum rate the flow must have to 2489 continue monitoring (kbits_sec = 1000 2490 bits/sec) */ 2491 uint32 rate_high_threshold_kbits_sec; /* Rate that must be observed at least 2492 once during monitoring interval for a 2493 flow to pass the monitoring criteria 2494 (kbits_sec = 1000 bits/sec) */ 2495 uint64 size_threshold_bytes; /* Total size in bytes that must be 2496 observed after the monitoring 2497 interval for a flow to pass the 2498 monitoring criteria */ 2499 } bcm_flowtracker_elephant_filter_t; 2500 2501 /* Flowtracker Elephant profile info */ 2502 typedef struct bcm_flowtracker_elephant_profile_info_s { 2503 uint8 num_promotion_filters; /* Number of promotion filters */ 2504 bcm_flowtracker_elephant_filter_t promotion_filters[BCM_FLOWTRACKER_ELEPHANT_MAX_PROMOTION_FILTERS]; /* Promotion filters */ 2505 bcm_flowtracker_elephant_filter_t demotion_filter; /* Demotion filter */ 2506 } bcm_flowtracker_elephant_profile_info_t; 2507 2508 /* Initialize an elephant profile */ 2509 extern void bcm_flowtracker_elephant_profile_info_t_init( 2510 bcm_flowtracker_elephant_profile_info_t *profile); 2511 2512 #ifndef BCM_HIDE_DISPATCHABLE 2513 2514 /* Create flowtracker elephant profile. */ 2515 extern int bcm_flowtracker_elephant_profile_create( 2516 int unit, 2517 uint32 options, 2518 bcm_flowtracker_elephant_profile_info_t *profile, 2519 bcm_flowtracker_elephant_profile_t *profile_id); 2520 2521 /* Destroy a flowtracker elephant profile */ 2522 extern int bcm_flowtracker_elephant_profile_destroy( 2523 int unit, 2524 bcm_flowtracker_elephant_profile_t profile_id); 2525 2526 /* Get flowtracker elephant profile information. */ 2527 extern int bcm_flowtracker_elephant_profile_get( 2528 int unit, 2529 bcm_flowtracker_elephant_profile_t profile_id, 2530 bcm_flowtracker_elephant_profile_info_t *profile); 2531 2532 /* Get all the configured flowtracker elephant profiles */ 2533 extern int bcm_flowtracker_elephant_profile_get_all( 2534 int unit, 2535 int max, 2536 bcm_flowtracker_elephant_profile_t *profile_list, 2537 int *count); 2538 2539 /* Attach a flow group with an elephant profile. */ 2540 extern int bcm_flowtracker_group_elephant_profile_attach( 2541 int unit, 2542 bcm_flowtracker_group_t flow_group_id, 2543 bcm_flowtracker_elephant_profile_t profile_id); 2544 2545 /* Get the elephant profile Id attached to a flow group. */ 2546 extern int bcm_flowtracker_group_elephant_profile_attach_get( 2547 int unit, 2548 bcm_flowtracker_group_t flow_group_id, 2549 bcm_flowtracker_elephant_profile_t *profile_id); 2550 2551 /* Detach a flow group from an elephant profile. */ 2552 extern int bcm_flowtracker_group_elephant_profile_detach( 2553 int unit, 2554 bcm_flowtracker_group_t flow_group_id); 2555 2556 #endif /* BCM_HIDE_DISPATCHABLE */ 2557 2558 /* Elephant match types */ 2559 #define BCM_FLOWTRACKER_ELEPHANT_MATCH_TYPE_PKT_TYPE_BMP (1 << 0) /* Packet type bitmap. */ 2560 #define BCM_FLOWTRACKER_ELEPHANT_MATCH_TYPE_INT_PRI_BMP (1 << 1) /* Internal priority 2561 bitmap. */ 2562 #define BCM_FLOWTRACKER_ELEPHANT_MATCH_TYPE_INGRESS_PBMP (1 << 2) /* Ingress port bitmap. */ 2563 #define BCM_FLOWTRACKER_ELEPHANT_MATCH_TYPE_EGRESS_PBMP (1 << 3) /* Egress port bitmap. */ 2564 2565 /* Elephant flow packet types */ 2566 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV4_TCP (1 << 0) /* IPv4 TCP packets. */ 2567 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV4_UDP (1 << 1) /* IPv4 UDP packets. */ 2568 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV4_OTHER (1 << 2) /* IPv4 non TCP, UDP 2569 packets. */ 2570 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV6_TCP (1 << 3) /* IPv6 TCP packets. */ 2571 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV6_UDP (1 << 4) /* IPv6 UDP packets. */ 2572 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_IPV6_OTHER (1 << 5) /* IPv6 non TCP, UDP 2573 packets. */ 2574 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_MPLS (1 << 6) /* MPLS packets. */ 2575 #define BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_OTHER (1 << 7) /* Non IPv4, IPv6, MPLS 2576 packets. */ 2577 2578 /* Elephant match data. */ 2579 typedef struct bcm_flowtracker_elephant_match_data_s { 2580 bcm_pbmp_t ingress_pbmp; /* Ingress port bitmap */ 2581 bcm_pbmp_t egress_pbmp; /* Egress port bitmap */ 2582 uint32 pkt_type_bmp; /* pkt type bitmap, See 2583 BCM_FLOWTRACKER_ELEPHANT_PKT_TYPE_XXX */ 2584 uint32 int_pri_bmp; /* Internal priority bitmap */ 2585 } bcm_flowtracker_elephant_match_data_t; 2586 2587 /* Initialize elephant match data. */ 2588 extern void bcm_flowtracker_elephant_match_data_t_init( 2589 bcm_flowtracker_elephant_match_data_t *match_data); 2590 2591 typedef enum bcm_flowtracker_elephant_match_action_e { 2592 bcmFlowtrackerElephantMatchActionLookup = 0, /* Enable elephant lookup */ 2593 bcmFlowtrackerElephantMatchActionQueue = 1, /* Enable queue actions */ 2594 bcmFlowtrackerElephantMatchActionColor = 2, /* Enable color actions */ 2595 bcmFlowtrackerElephantMatchActionCount = 3 /* Always Last. Not a usable value. */ 2596 } bcm_flowtracker_elephant_match_action_t; 2597 2598 #ifndef BCM_HIDE_DISPATCHABLE 2599 2600 /* Set the match criteria for an elephant action. */ 2601 extern int bcm_flowtracker_elephant_action_match_set( 2602 int unit, 2603 bcm_flowtracker_elephant_match_action_t action, 2604 uint32 match_types, 2605 bcm_flowtracker_elephant_match_data_t *match_data); 2606 2607 /* Get the match criteria for an elephant action. */ 2608 extern int bcm_flowtracker_elephant_action_match_get( 2609 int unit, 2610 bcm_flowtracker_elephant_match_action_t action, 2611 uint32 *match_types, 2612 bcm_flowtracker_elephant_match_data_t *match_data); 2613 2614 /* Set the internal priority remap for elephant flows. */ 2615 extern int bcm_flowtracker_elephant_int_pri_remap_set( 2616 int unit, 2617 bcm_cos_t int_pri, 2618 bcm_cos_t new_int_pri); 2619 2620 /* Get the internal priority remap for elephant flows. */ 2621 extern int bcm_flowtracker_elephant_int_pri_remap_get( 2622 int unit, 2623 bcm_cos_t int_pri, 2624 bcm_cos_t *new_int_pri); 2625 2626 #endif /* BCM_HIDE_DISPATCHABLE */ 2627 2628 /* Elephant controls */ 2629 typedef enum bcm_flowtracker_elephant_control_e { 2630 bcmFlowtrackerElephantControlMonitorIntervalUsecs = 0, /* Elephant monitor interval in 2631 microseconds */ 2632 bcmFlowtrackerElephantControlBloomFilterByteThreshold = 1, /* Bloom filter promotion threshold in 2633 bytes */ 2634 bcmFlowtrackerElephantControlElephantThresholdBytes = 2, /* Elephant promotion threshold in bytes */ 2635 bcmFlowtrackerElephantControlDemotionThresholdBytes = 3, /* Elephant demotion threshold in bytes */ 2636 bcmFlowtrackerElephantControlYellowThreshold = 4, /* Threshold in bytes to mark an 2637 elephant flow as yellow */ 2638 bcmFlowtrackerElephantControlRedThreshold = 5, /* Threshold in bytes to mark an 2639 elephant flow as red */ 2640 bcmFlowtrackerElephantControlPacketRemarkEnable = 6, /* Enable packet remarking */ 2641 bcmFlowtrackerElephantControlSampleRate = 7, /* Set elephant flow sample rate (Every 2642 1 in 'arg' number of packets will be 2643 sampled) */ 2644 bcmFlowtrackerElephantControlSampleSeed = 8, /* Set seed for the random number 2645 generator used for sampling */ 2646 bcmFlowtrackerElephantControlSampleCopyToCpu = 9, /* Copy to CPU sampled packets */ 2647 bcmFlowtrackerElephantControlCount = 10 /* Last Value. Not Usable. */ 2648 } bcm_flowtracker_elephant_control_t; 2649 2650 #ifndef BCM_HIDE_DISPATCHABLE 2651 2652 /* Set elephant controls */ 2653 extern int bcm_flowtracker_elephant_control_set( 2654 int unit, 2655 bcm_flowtracker_elephant_control_t type, 2656 int arg); 2657 2658 /* Get elephant controls */ 2659 extern int bcm_flowtracker_elephant_control_get( 2660 int unit, 2661 bcm_flowtracker_elephant_control_t type, 2662 int *arg); 2663 2664 #endif /* BCM_HIDE_DISPATCHABLE */ 2665 2666 /* Elephant hash tables */ 2667 typedef enum bcm_flowtracker_elephant_hash_table_e { 2668 bcmFlowtrackerElephantHashTableBloomFilter = 0, /* Bloom filter hash table. */ 2669 bcmFlowtrackerElephantHashTableFlowTable = 1, /* Elephant flow table. */ 2670 bcmFlowtrackerElephantHashTableCount = 2 /* Last Value. Not Usable. */ 2671 } bcm_flowtracker_elephant_hash_table_t; 2672 2673 /* Elephant hash types */ 2674 typedef enum bcm_flowtracker_elephant_hash_type_e { 2675 bcmFlowtrackerElephantHashTypeField0Function0 = 0, /* Hash field 0, mode 0 configured using 2676 bcmSwitchHashField0Config */ 2677 bcmFlowtrackerElephantHashTypeField0Function1 = 1, /* Hash field 0, mode 1 configured using 2678 bcmSwitchHashField0Config1. */ 2679 bcmFlowtrackerElephantHashTypeField1Function0 = 2, /* Hash field 1, mode 0 configured using 2680 bcmSwitchHashField1Config. */ 2681 bcmFlowtrackerElephantHashTypeField1Function1 = 3, /* Hash field 1, mode 1 configured using 2682 bcmSwitchHashField1Config1. */ 2683 bcmbcmFlowtrackerElephantHashTypeCount = 4 /* Last Value. Not Usable. */ 2684 } bcm_flowtracker_elephant_hash_type_t; 2685 2686 #ifndef BCM_HIDE_DISPATCHABLE 2687 2688 /* Set the hashing configuration */ 2689 extern int bcm_flowtracker_elephant_hash_config_set( 2690 int unit, 2691 bcm_flowtracker_elephant_hash_table_t hash_table, 2692 int instance_num, 2693 int bank_num, 2694 bcm_flowtracker_elephant_hash_type_t hash_type, 2695 int right_rotate_bits); 2696 2697 /* Get the hashing configuration */ 2698 extern int bcm_flowtracker_elephant_hash_config_get( 2699 int unit, 2700 bcm_flowtracker_elephant_hash_table_t hash_table, 2701 int instance_num, 2702 int bank_num, 2703 bcm_flowtracker_elephant_hash_type_t *hash_type, 2704 int *right_rotate_bits); 2705 2706 #endif /* BCM_HIDE_DISPATCHABLE */ 2707 2708 /* Elephant statistics */ 2709 typedef struct bcm_flowtracker_elephant_stats_s { 2710 uint64 num_candidates_detected; /* Total number of candidate flows that 2711 were detected */ 2712 uint64 num_flow_table_insert_failures; /* Total number of elephant flow table 2713 insertion failures */ 2714 uint64 num_flow_table_insert_success; /* Total number of elephant flow table 2715 insertion success */ 2716 uint64 num_elephants_detected; /* Total number of elephants that were 2717 detected */ 2718 } bcm_flowtracker_elephant_stats_t; 2719 2720 /* Initialize elephant monitoring statistics structure. */ 2721 extern void bcm_flowtracker_elephant_stats_t_init( 2722 bcm_flowtracker_elephant_stats_t *stats); 2723 2724 #ifndef BCM_HIDE_DISPATCHABLE 2725 2726 /* Set the elephant monitoring statistics */ 2727 extern int bcm_flowtracker_elephant_stats_set( 2728 int unit, 2729 bcm_flowtracker_elephant_stats_t *stats); 2730 2731 /* Get the elephant monitoring statistics */ 2732 extern int bcm_flowtracker_elephant_stats_get( 2733 int unit, 2734 bcm_flowtracker_elephant_stats_t *stats); 2735 2736 /* Get the elephant monitoring statistics */ 2737 extern int bcm_flowtracker_elephant_stats_sync_get( 2738 int unit, 2739 bcm_flowtracker_elephant_stats_t *stats); 2740 2741 #endif /* BCM_HIDE_DISPATCHABLE */ 2742 2743 /* Flowtracker Chip Debug configuration. */ 2744 typedef struct bcm_flowtracker_chip_debug_info_s { 2745 bcm_flowtracker_tracking_param_type_t param; /* The attribute of flow on which 2746 debugging is enabled. */ 2747 uint32 count; /* Count of the pass events happened for 2748 a particular check. */ 2749 } bcm_flowtracker_chip_debug_info_t; 2750 2751 /* Initialize flowtracker Chip Debug information. */ 2752 extern void bcm_flowtracker_chip_debug_info_t_init( 2753 bcm_flowtracker_chip_debug_info_t *info); 2754 2755 #ifndef BCM_HIDE_DISPATCHABLE 2756 2757 /* Set flowtracker chip wide debug tracking parameters info. */ 2758 extern int bcm_flowtracker_chip_debug_info_set( 2759 int unit, 2760 int num_debug_info, 2761 bcm_flowtracker_chip_debug_info_t *list_of_debug_info); 2762 2763 /* Get flowtracker tracking parameters debug information. */ 2764 extern int bcm_flowtracker_chip_debug_info_get( 2765 int unit, 2766 int max_debug_info_size, 2767 bcm_flowtracker_chip_debug_info_t *list_of_debug_info, 2768 int *actual_debug_info_size); 2769 2770 /* Add a new static flow to the flow group. */ 2771 extern int bcm_flowtracker_static_flow_add( 2772 int unit, 2773 bcm_flowtracker_group_t flow_group_id, 2774 bcm_flowtracker_flow_key_t *flow_key); 2775 2776 /* Delete an existing static flow from the flow group. */ 2777 extern int bcm_flowtracker_static_flow_delete( 2778 int unit, 2779 bcm_flowtracker_group_t flow_group_id, 2780 bcm_flowtracker_flow_key_t *flow_key); 2781 2782 /* Delete all existing static flows from the flow group. */ 2783 extern int bcm_flowtracker_static_flow_delete_all( 2784 int unit, 2785 bcm_flowtracker_group_t flow_group_id); 2786 2787 /* Get all static flows installed for a given flow group. */ 2788 extern int bcm_flowtracker_static_flow_get_all( 2789 int unit, 2790 bcm_flowtracker_group_t flow_group_id, 2791 int max_size, 2792 bcm_flowtracker_flow_key_t *flow_key_arr, 2793 int *list_size); 2794 2795 #endif /* BCM_HIDE_DISPATCHABLE */ 2796 2797 /* The different sources for Flowtracker Class */ 2798 typedef enum bcm_flowtracker_class_source_type_e { 2799 bcmFlowtrackerClassSourceTypeNone = 0, /* No Class Id. */ 2800 bcmFlowtrackerClassSourceTypePort = 1, /* Class Id from Port. */ 2801 bcmFlowtrackerClassSourceTypeSvp = 2, /* Class Id from Source Vp. */ 2802 bcmFlowtrackerClassSourceTypeL3Interface = 3, /* Class Id from L3 Interface. */ 2803 bcmFlowtrackerClassSourceTypeFieldSrc = 4, /* Class Id from VFP HI. */ 2804 bcmFlowtrackerClassSourceTypeFieldDst = 5, /* Class Id from VFP LO. */ 2805 bcmFlowtrackerClassSourceTypeL2Src = 6, /* Class Id from L2 Src. */ 2806 bcmFlowtrackerClassSourceTypeL2Dst = 7, /* Class Id from L2 Dst. */ 2807 bcmFlowtrackerClassSourceTypeL3Src = 8, /* Class Id from L3 Src. */ 2808 bcmFlowtrackerClassSourceTypeL3Dst = 9, /* Class Id from L3 Dst. */ 2809 bcmFlowtrackerClassSourceTypeVlan = 10, /* Class Id from Vlan. */ 2810 bcmFlowtrackerClassSourceTypeVrf = 11, /* Class Id from Vrf. */ 2811 bcmFlowtrackerClassSourceTypeFieldExactMatchLookUp0 = 12, /* Class Id from ExactMatch First 2812 Lookup. */ 2813 bcmFlowtrackerClassSourceTypeFieldExactMatchLookUp1 = 13, /* Class Id from ExactMatch Second 2814 Lookup. */ 2815 bcmFlowtrackerClassSourceTypeFieldIngress = 14, /* Class Id from IFP Policy Table. */ 2816 bcmFlowtrackerClassSourceTypeI2E = 15, /* Class Id from Ingress to Egress. */ 2817 bcmFlowtrackerClassSourceTypeNextHopA = 16, /* Class Id from NextHop A. */ 2818 bcmFlowtrackerClassSourceTypeNextHopB = 17, /* Class Id from NextHop B. */ 2819 bcmFlowtrackerClassSourceTypeL3InterfaceA = 18, /* Class Id from L3 Interface A. */ 2820 bcmFlowtrackerClassSourceTypeL3InterfaceB = 19, /* Class Id from L3 Interface B. */ 2821 bcmFlowtrackerClassSourceTypeDstVp = 20, /* Class Id from Destination virtual 2822 port */ 2823 bcmFlowtrackerClassSourceTypeIpTunnel = 21, /* Class Id from Ip Tunnel. */ 2824 bcmFlowtrackerClassSourceTypeXlateNextHopA = 22, /* Class Id from translated NextHop A. */ 2825 bcmFlowtrackerClassSourceTypeXlateNextHopB = 23, /* Class Id from translated NextHop B. */ 2826 bcmFlowtrackerClassSourceTypeXlateL3InterfaceA = 24, /* Class Id from translated L3 Interface 2827 A. */ 2828 bcmFlowtrackerClassSourceTypeXlateL3InterfaceB = 25, /* Class Id from translated L3 Interface 2829 B. */ 2830 bcmFlowtrackerClassSourceTypeXlateDstVp = 26, /* Class Id from translated destination 2831 virtual port */ 2832 bcmFlowtrackerClassSourceTypeXlateIpTunnel = 27, /* Class Id from translated Ip Tunnel. */ 2833 bcmFlowtrackerClassSourceTypeCount = 28 /* Always Last. Not a usable value. */ 2834 } bcm_flowtracker_class_source_type_t; 2835 2836 #define BCM_FLOWTRACKER_CLASS_SOURCE_TYPE_STRINGS \ 2837 { \ 2838 "None", \ 2839 "Port", \ 2840 "Svp", \ 2841 "L3Interface", \ 2842 "FieldSrc", \ 2843 "FieldDst", \ 2844 "L2Src", \ 2845 "L2Dst", \ 2846 "L3Src", \ 2847 "L3Dst", \ 2848 "Vlan", \ 2849 "Vrf", \ 2850 "FieldExactMatchLookUp0", \ 2851 "FieldExactMatchLookUp1", \ 2852 "FieldIngress", \ 2853 "I2E", \ 2854 "NextHopA", \ 2855 "NextHopB", \ 2856 "L3InterfaceA", \ 2857 "L3InterfaceB", \ 2858 "DstVp", \ 2859 "IpTunnel", \ 2860 "XlateNextHopA", \ 2861 "XlateNextHopB", \ 2862 "XlateL3InterfaceA", \ 2863 "XlateL3InterfaceB", \ 2864 "XlateDstVp", \ 2865 "XlateIpTunnel", \ 2866 "Count" \ 2867 } 2868 2869 /* Flowtracker Aggregate Class information. */ 2870 typedef struct bcm_flowtracker_aggregate_class_info_s { 2871 bcm_flowtracker_class_source_type_t source_type1; 2872 bcm_flowtracker_class_source_type_t source_type2; 2873 } bcm_flowtracker_aggregate_class_info_t; 2874 2875 /* 2876 * Options that can be passed via options parameter during flowtracker 2877 * aggregate class creation. 2878 */ 2879 #define BCM_FLOWTRACKER_AGGREGATE_CLASS_WITH_ID (1 << 0) /* Create flowtracker 2880 aggregate class with 2881 ID. */ 2882 2883 /* Initialize flowtracker aggregate class info. */ 2884 extern void bcm_flowtracker_aggregate_class_info_t_init( 2885 bcm_flowtracker_aggregate_class_info_t *agg_class_info); 2886 2887 #ifndef BCM_HIDE_DISPATCHABLE 2888 2889 /* Create flowtracker aggregate class for given group type. */ 2890 extern int bcm_flowtracker_aggregate_class_create( 2891 int unit, 2892 uint32 options, 2893 bcm_flowtracker_group_type_t group_type, 2894 bcm_flowtracker_aggregate_class_info_t *aggregate_class_info, 2895 uint32 *aggregate_class); 2896 2897 /* Get flowtracker aggregate class info. */ 2898 extern int bcm_flowtracker_aggregate_class_get( 2899 int unit, 2900 uint32 aggregate_class, 2901 bcm_flowtracker_group_type_t group_type, 2902 bcm_flowtracker_aggregate_class_info_t *aggregate_class_info); 2903 2904 /* Get all flowtracker aggregate classes configured in the system. */ 2905 extern int bcm_flowtracker_aggregate_class_get_all( 2906 int unit, 2907 bcm_flowtracker_group_type_t group_type, 2908 int size, 2909 uint32 *aggregate_class_array, 2910 int *actual_size); 2911 2912 /* Destroy flowtracker aggregate class. */ 2913 extern int bcm_flowtracker_aggregate_class_destroy( 2914 int unit, 2915 uint32 aggregate_class, 2916 bcm_flowtracker_group_type_t group_type); 2917 2918 #endif /* BCM_HIDE_DISPATCHABLE */ 2919 2920 /* Flags for setting up periodic export interval */ 2921 #define BCM_FLOWTRACKER_TYPE_MICRO (1 << 0) /* Micro Flowtracker type */ 2922 #define BCM_FLOWTRACKER_TYPE_AGGREGATE (1 << 1) /* Aggregate Flowtracker type */ 2923 2924 /* Flags for periodic export configurations */ 2925 #define BCM_FLOWTRACKER_MICRO_PERIODIC_EXPORT_GUARANTEE (1 << 0) /* If this flag is set, 2926 export of records due 2927 to periodic export are 2928 discarded if no 2929 resources 2930 are available to 2931 export the record. */ 2932 2933 /* Structure for Flowtracker periodic export config. */ 2934 typedef struct bcm_flowtracker_periodic_export_config_s { 2935 uint32 flags; /* Flags. */ 2936 uint32 interval_msec; /* Periodic export interval in milliseconds. */ 2937 } bcm_flowtracker_periodic_export_config_t; 2938 2939 /* Initialize a export period config structure. */ 2940 extern void bcm_flowtracker_periodic_export_config_t_init( 2941 bcm_flowtracker_periodic_export_config_t *config); 2942 2943 #ifndef BCM_HIDE_DISPATCHABLE 2944 2945 /* Set periodic export configuration */ 2946 extern int bcm_flowtracker_periodic_export_config_set( 2947 int unit, 2948 uint32 ft_type_flags, 2949 bcm_flowtracker_periodic_export_config_t *config); 2950 2951 /* Get periodic export configuration */ 2952 extern int bcm_flowtracker_periodic_export_config_get( 2953 int unit, 2954 uint32 ft_type_flags, 2955 bcm_flowtracker_periodic_export_config_t *config); 2956 2957 #endif /* BCM_HIDE_DISPATCHABLE */ 2958 2959 /* Types of exact match table indexing modes */ 2960 typedef enum bcm_flowtracker_exact_match_idx_mode_e { 2961 bcmFlowtrackerExactMatchIdxModeSingle = 0, /* Single wide entry */ 2962 bcmFlowtrackerExactMatchIdxModeDouble = 1, /* Double wide entry */ 2963 bcmFlowtrackerExactMatchIdxModeQuad = 2 /* Quad wide entry */ 2964 } bcm_flowtracker_exact_match_idx_mode_t; 2965 2966 /* 2967 * Information required for performing a delete/modify action on a learnt 2968 * flow. 2969 */ 2970 typedef struct bcm_flowtracker_group_flow_action_info_s { 2971 uint8 pipe_idx; /* Pipe on which the flow was learnt. */ 2972 bcm_flowtracker_exact_match_idx_mode_t mode; /* Exact match index mode. */ 2973 uint32 exact_match_idx; /* Exact match index of the learnt flow. */ 2974 } bcm_flowtracker_group_flow_action_info_t; 2975 2976 #ifndef BCM_HIDE_DISPATCHABLE 2977 2978 /* 2979 * Delete a flow entry learnt by HW in exact match table. This API is 2980 * allowed only when flowtracker_hardware_learn_enable = 2. 2981 */ 2982 extern int bcm_flowtracker_group_flow_delete( 2983 int unit, 2984 bcm_flowtracker_group_t id, 2985 bcm_flowtracker_group_flow_action_info_t *action_info); 2986 2987 /* 2988 * Modify the action data of a flow entry learnt by HW in exact match 2989 * table. Note that the action types should match whatever is configured 2990 * for the group already. This allows only changing the values of those 2991 * actions. This API is allowed only when 2992 * flowtracker_hardware_learn_enable = 2. 2993 */ 2994 extern int bcm_flowtracker_group_flow_action_update( 2995 int unit, 2996 bcm_flowtracker_group_t id, 2997 bcm_flowtracker_group_flow_action_info_t *action_info, 2998 int num_actions, 2999 bcm_flowtracker_group_action_info_t *action_list); 3000 3001 #endif /* BCM_HIDE_DISPATCHABLE */ 3002 3003 /* Enumerations for flowtracker global controls. */ 3004 typedef enum bcm_flowtracker_control_type_e { 3005 bcmFlowtrackerControlTcpBidirEstablishedDoNotLearn = 0, /* Do not learn flows which is already 3006 in an established state before being 3007 seen by BroadScan. */ 3008 bcmFlowtrackerControlCount = 1 /* Not used. */ 3009 } bcm_flowtracker_control_type_t; 3010 3011 #ifndef BCM_HIDE_DISPATCHABLE 3012 3013 /* To configure global controls in flowtracker */ 3014 extern int bcm_flowtracker_control_set( 3015 int unit, 3016 bcm_flowtracker_control_type_t type, 3017 int arg); 3018 3019 /* To get global controls in flowtracker */ 3020 extern int bcm_flowtracker_control_get( 3021 int unit, 3022 bcm_flowtracker_control_type_t type, 3023 int *arg); 3024 3025 /* To configure Default Egress Class Id source in flowtracker */ 3026 extern int bcm_flowtracker_egress_class_source_set( 3027 int unit, 3028 uint32 options, 3029 bcm_flowtracker_class_source_type_t source_type); 3030 3031 /* To get configured Default Egress Class Id source in flowtracker. */ 3032 extern int bcm_flowtracker_egress_class_source_get( 3033 int unit, 3034 uint32 options, 3035 bcm_flowtracker_class_source_type_t *source_type); 3036 3037 #endif /* BCM_HIDE_DISPATCHABLE */ 3038 3039 /* Flowtraker group record information contents. */ 3040 typedef enum bcm_flowtracker_group_record_type_e { 3041 bcmFlowtrackerGroupRecordTypeKeyOnly = 0, /* Flowtracker group record with Key 3042 only. */ 3043 bcmFlowtrackerGroupRecordTypeKeyData = 1, /* Flowtracker group record with key and 3044 data. */ 3045 bcmFlowtrackerGroupRecordTypeCount = 2 /* Last Value. Not Usable. */ 3046 } bcm_flowtracker_group_record_type_t; 3047 3048 /* Flowtracker Group record. */ 3049 typedef struct bcm_flowtracker_group_record_info_s { 3050 bcm_flowtracker_group_t group_id; /* Flowtracker Group Id of the record. */ 3051 uint32 index; /* Index of flowtracker group record. */ 3052 bcm_flowtracker_group_record_type_t type; /* Flowtracker Group record valid 3053 content type */ 3054 bcm_flowtracker_export_record_t record; /* Flowtracker Group record */ 3055 } bcm_flowtracker_group_record_info_t; 3056 3057 /* Initialize flowtracker group record information. */ 3058 extern void bcm_flowtracker_group_record_info_t_init( 3059 bcm_flowtracker_group_record_info_t *info); 3060 3061 /* User callback for flowtracker group record traverse routine. */ 3062 typedef int(*bcm_flowtracker_group_record_traverse_cb)( 3063 int unit, 3064 bcm_flowtracker_group_record_info_t *info, 3065 void *user_data); 3066 3067 #ifndef BCM_HIDE_DISPATCHABLE 3068 3069 /* Traverse flowtracker group records. */ 3070 extern int bcm_flowtracker_group_record_traverse( 3071 int unit, 3072 bcm_flowtracker_group_t group_id, 3073 bcm_flowtracker_group_record_type_t type, 3074 bcm_flowtracker_group_record_traverse_cb cb, 3075 void *user_data); 3076 3077 #endif /* BCM_HIDE_DISPATCHABLE */ 3078 3079 /* Max size of the data in export record. */ 3080 #define BCM_FLOWTRACKER_EXPORT_RECORD_DATA_MAX_LENGTH 16 /* Maximum length of a 3081 data in record. */ 3082 3083 /* Flowtracker Export record data information. */ 3084 typedef struct bcm_flowtracker_export_record_data_info_s { 3085 bcm_flowtracker_export_element_info_t export_element_info; /* Flowtracker Export element 3086 information. */ 3087 uint8 data[BCM_FLOWTRACKER_EXPORT_RECORD_DATA_MAX_LENGTH]; /* Raw data in network byte order. */ 3088 } bcm_flowtracker_export_record_data_info_t; 3089 3090 /* Initialize flowtracker export record data information. */ 3091 extern void bcm_flowtracker_export_record_data_info_t_init( 3092 bcm_flowtracker_export_record_data_info_t *data_info); 3093 3094 #ifndef BCM_HIDE_DISPATCHABLE 3095 3096 /* To get data from raw export record. */ 3097 extern int bcm_flowtracker_export_record_data_info_get( 3098 int unit, 3099 bcm_flowtracker_export_record_t *record, 3100 int max_elements, 3101 bcm_flowtracker_export_element_info_t *export_element_info, 3102 bcm_flowtracker_export_record_data_info_t *data_info, 3103 int *count); 3104 3105 #endif /* BCM_HIDE_DISPATCHABLE */ 3106 3107 /* UDF Tracking param information. */ 3108 typedef struct bcm_flowtracker_udf_info_s { 3109 bcm_udf_id_t udf_id; /* UDF object identifier */ 3110 int offset; /* Relative offset (in bits) in extracted UDF */ 3111 int width; /* Width of data in bits */ 3112 } bcm_flowtracker_udf_info_t; 3113 3114 /* Initialize flowtracker udf information. */ 3115 extern void bcm_flowtracker_udf_info_t_init( 3116 bcm_flowtracker_udf_info_t *info); 3117 3118 #ifndef BCM_HIDE_DISPATCHABLE 3119 3120 /* To set Flowtracker Tracking parameter UDF information. */ 3121 extern int bcm_flowtracker_udf_tracking_param_set( 3122 int unit, 3123 uint32 flags, 3124 bcm_flowtracker_tracking_param_type_t param, 3125 uint16 custom_id, 3126 bcm_flowtracker_udf_info_t *udf_info); 3127 3128 /* To get Flowtracker Tracking param UDF information. */ 3129 extern int bcm_flowtracker_udf_tracking_param_get( 3130 int unit, 3131 uint32 flags, 3132 bcm_flowtracker_tracking_param_type_t param, 3133 uint16 custom_id, 3134 bcm_flowtracker_udf_info_t *udf_info); 3135 3136 #endif /* BCM_HIDE_DISPATCHABLE */ 3137 3138 #endif /* __BCM_FLOWTRACKER_H__ */