l3.h (97601B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_L3_H__ 14 #define __BCM_L3_H__ 15 16 #if defined(INCLUDE_L3) 17 18 #include <bcm/types.h> 19 #include <bcm/stat.h> 20 #include <bcm/qos.h> 21 #include <bcm/mpls.h> 22 23 /* L3 module flags. */ 24 #define BCM_L3_L2ONLY (1 << 0) /* L2 switch only on 25 interface. */ 26 #define BCM_L3_UNTAG (1 << 1) /* Packet goes out untagged. */ 27 #define BCM_L3_S_HIT (1 << 2) /* Source IP address match. */ 28 #define BCM_L3_D_HIT (1 << 3) /* Destination IP address 29 match. */ 30 #define BCM_L3_HIT (BCM_L3_S_HIT | BCM_L3_D_HIT) 31 #define BCM_L3_HIT_CLEAR (1 << 4) /* Clear HIT bit. */ 32 #define BCM_L3_ADD_TO_ARL (1 << 5) /* Add interface address MAC 33 to ARL. */ 34 #define BCM_L3_WITH_ID (1 << 6) /* ID is provided. */ 35 #define BCM_L3_NEGATE (1 << 7) /* Negate a set. */ 36 #define BCM_L3_INGRESS_ONLY BCM_L3_NEGATE /* configure ingress objects 37 only. */ 38 #define BCM_L3_REPLACE (1 << 8) /* Replace existing entry. */ 39 #define BCM_L3_TGID (1 << 9) /* Port belongs to trunk. */ 40 #define BCM_L3_OVERLAY_ENCAP BCM_L3_TGID /* LL encapsulation, used for 41 overlay LL for intra DC 42 routed packets */ 43 #define BCM_L3_RPE (1 << 10) /* Pick up new priority 44 (COS). */ 45 #define BCM_L3_ENCAP_SPACE_OPTIMIZED BCM_L3_RPE /* Optimize encapsulation 46 database resources. */ 47 #define BCM_L3_IPMC (1 << 11) /* Set IPMC for real IPMC 48 entry. */ 49 #define BCM_L3_L2TOCPU (1 << 12) /* Packet to CPU unrouted, 50 XGS12: Set IPMC for UC 51 address. */ 52 #define BCM_L3_NATIVE_ENCAP BCM_L3_L2TOCPU /* Eth encapsulation, used 53 for nativ Ethernet for 54 intra DC routed packets */ 55 #define BCM_L3_DEFIP_CPU (1 << 13) /* Strata: DEFIP CPU bit set. */ 56 #define BCM_L3_DEFIP_LOCAL BCM_L3_DEFIP_CPU /* XGS: Local DEFIP route. */ 57 #define BCM_L3_VIRTUAL_OBJECT (1 << 13) /* FEC/egress-encap (virtual 58 FEC). */ 59 #define BCM_L3_EGRESS_ONLY BCM_L3_VIRTUAL_OBJECT /* Configure Egress objects 60 only. */ 61 #define BCM_L3_MULTIPATH (1 << 14) /* Specify ECMP treatment. */ 62 #define BCM_L3_HOST_LOCAL (1 << 15) /* Packet to local IP stack. */ 63 #define BCM_L3_HOST_AS_ROUTE (1 << 16) /* Use LPM if host table 64 full. */ 65 #define BCM_L3_IP6 (1 << 17) /* IPv6. */ 66 #define BCM_L3_RPF (1 << 18) /* RPF check. */ 67 #define BCM_L3_MC_RPF_EXPLICIT (BCM_L3_RPF | BCM_L3_IPMC) /* Indicates explicit 68 multicast RPF mode */ 69 #define BCM_L3_MC_RPF_SIP_BASE BCM_L3_RPF /* Indicates SIP base 70 multicast RPF mode */ 71 #define BCM_L3_MC_RPF_EXPLICIT_ECMP (BCM_L3_RPF | BCM_L3_MULTIPATH) /* Indicate Explicit 72 multicast ECMP RPF mode */ 73 #define BCM_L3_MC_NO_RPF (BCM_L3_RPF | BCM_L3_L2ONLY) /* Indicates no multicast RPF 74 mode */ 75 #define BCM_L3_SRC_DISCARD (1 << 19) /* Source Match Discard. */ 76 #define BCM_L3_DST_DISCARD (1 << 20) /* Destination match discard. */ 77 #define BCM_L3_SECONDARY (1 << 21) /* Secondary L3 interface 78 (Must NOT be used with 79 L3_CASCADED) */ 80 #define BCM_L3_CASCADED (1 << 21) /* Indicates an L3 egress 81 interface pointed by 82 another L3 egress 83 interface (Must NOT be 84 used with L3_SECONDARY) */ 85 #define BCM_L3_2ND_HIERARCHY BCM_L3_CASCADED /* Indicates that an L3 86 egress/ECMP interface is 87 placed on a 2nd hierarchy 88 level of L3 egresses/ECMPs 89 (Can be replaced by 90 BCM_L3_CASCADED). */ 91 #define BCM_L3_ROUTE_LABEL (1 << 22) /* Indicates that MPLS label 92 in route entry is valid. */ 93 #define BCM_L3_COPY_TO_CPU (1 << 23) /* Send a copy to CPU. */ 94 #define BCM_L3_KEEP_SRCMAC (1 << 24) /* Disable SA replacement for 95 L3UC packets. */ 96 #define BCM_L3_KEEP_DSTMAC (1 << 25) /* Disable DA replacement for 97 L3UC packets. */ 98 #define BCM_L3_KEEP_VLAN (1 << 26) /* Disable VLAN replacement 99 for L3UC packets. */ 100 #define BCM_L3_KEEP_TTL (1 << 27) /* Disable TTL replacement 101 for L3UC packets.When used 102 in conjunction with 103 BCM_L3_ROUTE_LABEL, 104 disable TTL replacement 105 for MPLS flows */ 106 #define BCM_L3_TRILL_ONLY (1 << 28) /* Specific for TRILL Nexthop */ 107 #define BCM_L3_SRC_DST_NAT_REALM_ID (1 << 28) /* To set the nat realm id to 108 both source nat id and 109 destionation nat id. */ 110 #define BCM_L3_L2GRE_ONLY (1 << 29) /* Specific for L2GRE Nexthop */ 111 #define BCM_L3_QUEUE_MAP (1 << 30) /* Use queue map to derive 112 queue number */ 113 #define BCM_L3_3RD_HIERARCHY BCM_L3_QUEUE_MAP /* Indicates that an L3 114 egress/ECMP interface is 115 placed on a 3rd hierarchy 116 level of L3 117 egresses/ECMPs. */ 118 #define BCM_L3_DEREFERENCED_NEXTHOP (1 << 30) /* Indicates this is a wider 119 L3 entry. */ 120 #define BCM_L3_ECMP_RH_REPLACE BCM_L3_DEREFERENCED_NEXTHOP /* Replace ECMP member 121 without RH flowset table 122 shuffle. */ 123 #define BCM_L3_VXLAN_ONLY (1 << 31) /* Specific for VXLAN Nexthop */ 124 125 /* L3 module flags2. */ 126 #define BCM_L3_FLAGS2_NIV_ENCAP_LOCAL (1 << 0) /* Apply VNTAG_ACTION on 127 outgoing packet to a 128 HiGig Port. */ 129 #define BCM_L3_FLAGS2_FIELD_ONLY (1 << 1) /* Specific for Field 130 Nexthop. */ 131 #define BCM_L3_FLAGS2_UNDERLAY (1 << 2) /* Create underlay next 132 hop on a virtual port. */ 133 #define BCM_L3_FLAGS2_SRC_DST_MAC_SWAP (1 << 3) /* Swap outgoing packets 134 L2 header SRC/DST MAC 135 fields, for IFP L3 136 egress objects only. */ 137 #define BCM_L3_FLAGS2_EGRESS_WIDE (1 << 4) /* Configure egress wide 138 entry. */ 139 #define BCM_L3_FLAGS2_NO_ECMP_OVERLAP (1 << 5) /* Create next hop on the 140 index without 141 overlapping ECMP 142 indexes */ 143 #define BCM_L3_FLAGS2_SCALE_ROUTE (1 << 6) /* Scale the number of 144 routes. */ 145 #define BCM_L3_FLAGS2_RAW_ENTRY (1 << 7) /* Insert raw data 146 payload */ 147 #define BCM_L3_FLAGS2_SKIP_HIT_CLEAR (1 << 8) /* Skip hit clear when 148 creating a FEC to 149 enhance time 150 performance. */ 151 #define BCM_L3_FLAGS2_ROUTE_NO_MOVE (1 << 9) /* A flag only to be used 152 with BCM_L3_REPLACE 153 flag for avoiding host 154 entries move from the 155 route table to the 156 host table. */ 157 #define BCM_L3_FLAGS2_MPLS_PHP (1 << 10) /* Specific nexthop for 158 MPLS PHP. */ 159 #define BCM_L3_FLOW_ONLY (1 << 11) /* Specific for FLOW 160 Nexthop */ 161 #define BCM_L3_MPLS_GRE_LABEL (1 << 12) /* Specific for MPLS over 162 GRE label */ 163 #define BCM_L3_FLAGS2_XFLOW_MACSEC_ENCRYPT (1 << 13) /* Indicates the next hop 164 entry is for Macsec 165 encrypt */ 166 #define BCM_L3_FLAGS2_XFLOW_MACSEC_DECRYPT (1 << 14) /* Indicates the next hop 167 entry is for Macsec 168 decrypt */ 169 #define BCM_L3_FLAGS2_INGRESS_URPF_MODE (1 << 15) /* Enable fec rpf mode 170 configuration. */ 171 #define BCM_L3_FLAGS2_DECAP_ROE_HEADER (1 << 16) /* Indicates the 172 decapsulation of 173 ROE/ROE Custom Header */ 174 #define BCM_L3_FLAGS2_FCOE_ONLY (1 << 17) /* Specific for FCOE 175 Nexthop. */ 176 #define BCM_L3_FLAGS2_VLAN_TRANSLATION (1 << 18) /* Indicates that 177 bcm_l3_egress_create 178 should allocate ARP+AC 179 entry in EEDB. */ 180 #define BCM_L3_FLAGS2_SRC_MAC (1 << 19) /* Indicates that 181 bcm_l3_egress_create 182 should allocate ARP 183 with the ability to 184 set SA. */ 185 #define BCM_L3_FLAGS2_EGRESS_STAT_ENABLE (1 << 20) /* Indicates statistics 186 enabled. */ 187 #define BCM_L3_FLAGS2_ECMP_RANGE_OVERLAP (1 << 21) /* Indicate that the used 188 FEC ID is overlapping 189 the ECMP IDs range. */ 190 #define BCM_L3_FLAGS2_NON_PROXY_MODE (1 << 22) /* Indicate the 191 encapsulation of HG2 192 PPD-2 Header. */ 193 #define BCM_L3_FLAGS2_MC_GROUP (1 << 23) /* Indicate that the 194 destination is a 195 multicast group. */ 196 #define BCM_L3_FLAGS2_IFA_DST_PORT (1 << 24) /* Indicate that VN_TAG 197 fields need be 198 configured for IFA. */ 199 #define BCM_L3_FLAGS2_VIRTUAL_EGRESS_POINTED (1 << 25) /* Indicate egress object 200 is pointed from EEDB 201 only and not from 202 FWD/ACL Dbs. */ 203 #define BCM_L3_FLAGS2_VLAN_TRANSLATION_TWO_VLAN_TAGS (1 << 26) /* L3 object supports 204 VLAN Translation with 205 up to two VLAN tags. */ 206 #define BCM_L3_FLAGS2_FWD_ONLY (1 << 27) /* Add route to FWD. */ 207 #define BCM_L3_FLAGS2_RPF_ONLY (1 << 28) /* Add route to RPF. */ 208 209 /* L3 module Multicast flags. */ 210 #define BCM_L3_MULTICAST_L2_DEST_PRESERVE (1 << 0) /* L2 multicast dest 211 address replacement 212 disable */ 213 #define BCM_L3_MULTICAST_L2_SRC_PRESERVE (1 << 1) /* L2 multicast source 214 address replacement 215 disable */ 216 #define BCM_L3_MULTICAST_L2_VLAN_PRESERVE (1 << 2) /* L2 multicast outer 217 vlan replacement 218 disable */ 219 #define BCM_L3_MULTICAST_TTL_PRESERVE (1 << 3) /* L3 multicast TTL 220 decrement disable */ 221 #define BCM_L3_MULTICAST_DEST_PRESERVE (1 << 4) /* L3 multicast dest 222 address replacement 223 disable */ 224 #define BCM_L3_MULTICAST_SRC_PRESERVE (1 << 5) /* L3 multicast source 225 address replacement 226 disable */ 227 #define BCM_L3_MULTICAST_VLAN_PRESERVE (1 << 6) /* L3 multicast outer 228 vlan replacement 229 disable */ 230 #define BCM_L3_MULTICAST_L3_DROP (1 << 7) /* L3 multicast L3 drop */ 231 #define BCM_L3_MULTICAST_L2_DROP (1 << 8) /* L3 multicast L2 drop */ 232 233 /* L3 Ingress Interface flags. */ 234 #define BCM_L3_INGRESS_WITH_ID (1 << 0) /* L3 Ingress ID is 235 provided. */ 236 #define BCM_L3_INGRESS_REPLACE (1 << 1) /* Replace existing L3 237 Ingress entry. */ 238 #define BCM_L3_INGRESS_GLOBAL_ROUTE (1 << 2) /* Allow Global Route on 239 L3 Ingress Interface. */ 240 #define BCM_L3_INGRESS_DSCP_TRUST (1 << 3) /* Trust incoming DSCP on 241 L3 Ingress */ 242 #define BCM_L3_INGRESS_URPF_DEFAULT_ROUTE_CHECK (1 << 4) /* Allow URPF Check on 243 Default Routes. */ 244 #define BCM_L3_INGRESS_ROUTE_DISABLE_IP4_UCAST (1 << 5) /* Disable L3 routing on 245 IPv4 UC packets */ 246 #define BCM_L3_INGRESS_ROUTE_DISABLE_IP4_MCAST (1 << 6) /* Disable L3 routing on 247 IPv4 MC packets */ 248 #define BCM_L3_INGRESS_ROUTE_DISABLE_IP6_UCAST (1 << 7) /* Disable L3 routing on 249 IPv6 UC packets */ 250 #define BCM_L3_INGRESS_ROUTE_DISABLE_IP6_MCAST (1 << 8) /* Disable L3 routing on 251 IPv6 MC packets */ 252 #define BCM_L3_INGRESS_ROUTE_DISABLE_MPLS (1 << 9) /* Disable L3 routing on 253 MPLS packets */ 254 #define BCM_L3_INGRESS_IPMC_DO_VLAN_DISABLE (1 << 10) /* Disable using L3 255 interface as part of 256 IPMC forwarding lookup 257 key */ 258 #define BCM_L3_INGRESS_IPV6_ROUTING_HEADER_TYPE_0_DROP (1 << 11) /* Drop Ipv6 Header Type 259 0 packets */ 260 #define BCM_L3_INGRESS_UNKNOWN_SRC_TOCPU (1 << 12) /* Unresolved source for 261 L3 send to CPU */ 262 #define BCM_L3_INGRESS_UNKNOWN_IP4_MCAST_TOCPU (1 << 13) /* Unknown IPMC (IPMC 263 miss) for IPv4 packets 264 sent to CPU */ 265 #define BCM_L3_INGRESS_UNKNOWN_IP6_MCAST_TOCPU (1 << 14) /* Unknown IPMC (IPMC 266 miss) for IPv6 packets 267 sent to CPU */ 268 #define BCM_L3_INGRESS_ICMP_REDIRECT_TOCPU (1 << 15) /* Enables copy to cpu 269 when ICMP redirect 270 packet is needed */ 271 #define BCM_L3_INGRESS_UNKNOWN_IPMC_AS_L2MC (1 << 16) /* Enable L2MC processing 272 of Unknown IPMC (IPMC 273 miss) packets, instead 274 of flooding to vlan */ 275 #define BCM_L3_INGRESS_SRC_DST_NAT_REALM_ID (1 << 17) /* To set the nat id to 276 both source and 277 destination nat id. */ 278 #define BCM_L3_INGRESS_L3_MCAST_L2 (1 << 18) /* Set bridge V4MC 279 forwarding instead of 280 bridge forwarding in 281 case of IPV4 MC with 282 IPMC disable. */ 283 #define BCM_L3_INGRESS_EXT_IPV4_DOUBLE_CAPACITY (1 << 19) /* Enable L3 routing on 284 IPv4 double capacity 285 packets. */ 286 #define BCM_L3_INGRESS_TUNNEL_TERM_ECN_MAP (1 << 20) /* To set the tunnel 287 termination ecn map 288 id. */ 289 #define BCM_L3_INGRESS_MPLS_INTF_NAMESPACE (1 << 21) /* Indicates that if the 290 next layer is MPLS, 291 lookup is in per-I/F 292 context. */ 293 #define BCM_L3_INGRESS_INT (1 << 22) /* INT enable for L3 294 interface. */ 295 #define BCM_L3_INGRESS_IPMC_BRIDGE_FALLBACK (1 << 23) /* Set bridge fallback in 296 case of Unknown IPMC 297 (IPMC miss) packets. */ 298 299 /* L3 Interface QOS flags. */ 300 #define BCM_L3_INTF_QOS_OUTER_VLAN_PRI_COPY (1 << 0) /* Copy Outer Vlan .1p 301 from incoming packet 302 .1p. */ 303 #define BCM_L3_INTF_QOS_OUTER_VLAN_PRI_SET (1 << 1) /* Set Outer Vlan .1p 304 from table entry. */ 305 #define BCM_L3_INTF_QOS_OUTER_VLAN_PRI_REMARK (1 << 2) /* Remark Outer Vlan .1p 306 from PHB. */ 307 #define BCM_L3_INTF_QOS_INNER_VLAN_PRI_COPY (1 << 3) /* Copy Inner Vlan .1p 308 from incoming packet 309 .1p. */ 310 #define BCM_L3_INTF_QOS_INNER_VLAN_PRI_SET (1 << 4) /* Set Inner Vlan .1p 311 from table entry. */ 312 #define BCM_L3_INTF_QOS_INNER_VLAN_PRI_REMARK (1 << 5) /* Remark Outer Vlan .1p 313 from PHB. */ 314 #define BCM_L3_INTF_QOS_DSCP_COPY (1 << 6) /* Use existing DSCP */ 315 #define BCM_L3_INTF_QOS_DSCP_SET (1 << 7) /* Set DSCP from table 316 entry. */ 317 #define BCM_L3_INTF_QOS_DSCP_REMARK (1 << 8) /* Remark DSCP from PHB. */ 318 #define BCM_L3_INTF_OVERLAY_ENCAP (1 << 9) /* L3 interface used for 319 overlay routing. 320 Relevant for intra DC 321 routed packets */ 322 #define BCM_L3_INTF_NATIVE_ENCAP (1 << 10) /* L3 interface used for 323 native outing. 324 Relevant for intra DC 325 routed packets */ 326 327 /* L3 Egress Interface flags. */ 328 #define BCM_L3_INTF_INNER_VLAN_DO_NOT_MODIFY (1 << 0) /* Do not modify inner 329 VLAN Tag */ 330 #define BCM_L3_INTF_INNER_VLAN_ADD (1 << 1) /* Add Inner VLAN Tag */ 331 #define BCM_L3_INTF_INNER_VLAN_REPLACE (1 << 2) /* Replace Inner VLAN Tag */ 332 #define BCM_L3_INTF_INNER_VLAN_DELETE (1 << 3) /* Delete Inner VLAN Tag */ 333 334 /* Reserved VRF values . */ 335 #define BCM_L3_VRF_INVALID _SHR_L3_VRF_INVALID /* Invalid VRF ID. */ 336 #define BCM_L3_VRF_OVERRIDE _SHR_L3_VRF_OVERRIDE /* Matches before VRF specific 337 entries. */ 338 #define BCM_L3_VRF_GLOBAL _SHR_L3_VRF_GLOBAL /* Matches after VRF specific 339 entries. */ 340 #define BCM_L3_VRF_DEFAULT _SHR_L3_VRF_DEFAULT /* Default VRF ID. */ 341 342 /* Backward compatibility. */ 343 #define BCM_L3_TUNNEL_TYPE_IP6_IP4 BCM_L3_TUNNEL_TYPE_6TO4 344 345 /* Invalid L3 Ingress Interface */ 346 #define BCM_L3_INGRESS_INTERFACE_INVALID 4095 /* Invalid L3 Ingress 347 Interface */ 348 349 #define BCM_IP6_BYTE(a, n) (((uint8 *) (a))[n]) 350 351 #define BCM_IP6_HALF(a, n) (((uint16 *) (a))[n]) 352 353 #define BCM_IP6_WORD(a, n) (((uint8 *) (a))[n]) 354 355 #define BCM_IP4_MULTICAST(a) \ 356 (((a) & 0xf0000000) == 0xe0000000) 357 358 #define BCM_IP6_MULTICAST(a) \ 359 ((BCM_IP6_BYTE(a, 0)) == 0xff) 360 361 #define BCM_IP6_ADDR_EQ(a1, a2) \ 362 (sal_memcmp((a1), (a2), BCM_IP6_ADDRLEN) == 0) 363 364 #define BCM_IP6_LOOPBACK(a) \ 365 ((BCM_IP6_WORD((a), 0) | BCM_IP6_WORD((a), 1) | \ 366 BCM_IP6_WORD((a), 2) | BCM_IP6_HALF((a), 6) | \ 367 BCM_IP6_BYTE((a), 14)) == 0 && BCM_IP6_BYTE((a), 15) == 1) 368 369 #define BCM_IP6_V4_MAPPED(a) \ 370 ((BCM_IP6_WORD((a), 0) | BCM_IP6_WORD((a), 1) | \ 371 BCM_IP6_HALF((a), 4)) == 0 && BCM_IP6_HALF((a), 5) == 0xffff) 372 373 #define BCM_IP6_V4_COMPATIBLE(a) \ 374 (BCM_IP6_WORD((a), 0) | BCM_IP6_WORD((a), 1) | BCM_IP6_WORD((a), 2) == 0) 375 376 /* L3 ECMP options. */ 377 #define BCM_L3_ECMP_O_CREATE_WITH_ID (1 << 0) /* Create an Egress ECMP 378 forwarding object with 379 assigned Identifier */ 380 #define BCM_L3_ECMP_O_REPLACE (1 << 1) /* Replace/Update existing 381 Egress ECMP forwarding 382 object. */ 383 384 /* L3 Egress Interface flags. */ 385 #define BCM_L3_ECMP_RESILIENT_MATCH_HASH_KEY (1 << 0) /* Match on the hash key 386 value */ 387 #define BCM_L3_ECMP_RESILIENT_MATCH_INTF (1 << 1) /* Match on the interface 388 value */ 389 #define BCM_L3_ECMP_RESILIENT_MATCH_ECMP (1 << 2) /* Match on the ECMP-Id 390 value */ 391 #define BCM_L3_ECMP_RESILIENT_DELETE (1 << 3) /* Delete matched entries */ 392 #define BCM_L3_ECMP_RESILIENT_REPLACE (1 << 4) /* Replace matched 393 entries with 394 replace_entry */ 395 #define BCM_L3_ECMP_RESILIENT_COUNT (1 << 5) /* Count matched entries 396 in num_entries */ 397 398 /* L3 Interface QOS setting. */ 399 typedef struct bcm_l3_intf_qos_s { 400 uint32 flags; /* See BCM_L3_INTF_QOS_XXX flag definitions. */ 401 int qos_map_id; /* QOS Map ID. */ 402 uint8 pri; /* Packet .1p. */ 403 uint8 cfi; /* Packet CFI. */ 404 int dscp; /* Packet DSCP. */ 405 } bcm_l3_intf_qos_t; 406 407 /* 408 * L3 Interface Structure. 409 * 410 * Contains information required for manipulating L3 interfaces. 411 */ 412 typedef struct bcm_l3_intf_s { 413 uint32 l3a_flags; /* See BCM_L3_FLAGS_XXX flags 414 definitions. */ 415 uint32 l3a_flags2; /* See BCM_L3_FLAGS2_XXX flags 416 definitions. */ 417 bcm_vrf_t l3a_vrf; /* Virtual router instance. */ 418 bcm_if_t l3a_intf_id; /* Interface ID. */ 419 bcm_mac_t l3a_mac_addr; /* MAC address. */ 420 bcm_vlan_t l3a_vid; /* VLAN ID. */ 421 bcm_vlan_t l3a_inner_vlan; /* Inner vlan for double tagged packets. */ 422 int l3a_tunnel_idx; /* Tunnel (initiator) index. */ 423 int l3a_ttl; /* TTL threshold. */ 424 int l3a_mtu; /* MTU. */ 425 int l3a_mtu_forwarding; /* Forwarding Layer MTU. */ 426 bcm_if_group_t l3a_group; /* Interface group number. */ 427 bcm_l3_intf_qos_t vlan_qos; /* Outer-Vlan QoS Setting. */ 428 bcm_l3_intf_qos_t inner_vlan_qos; /* Inner-Vlan QoS Setting. */ 429 bcm_l3_intf_qos_t dscp_qos; /* DSCP QoS Setting. */ 430 int l3a_intf_class; /* L3 interface class ID */ 431 int l3a_ip4_options_profile_id; /* IP4 Options handling Profile ID */ 432 int l3a_nat_realm_id; /* Realm id of the interface for NAT */ 433 uint16 outer_tpid; /* TPID value */ 434 uint32 l3a_intf_flags; /* See BCM_L3_INTF_XXX flag definitions. */ 435 uint8 native_routing_vlan_tags; /* Set number of VLAN tags expected when 436 interface is used for native routing */ 437 bcm_gport_t l3a_source_vp; /* Source virtual port in overlay 438 domain. SVP is used for deriving port 439 properties in the egress device when 440 packets are sent over HG flow. */ 441 uint32 flow_handle; /* FLOW handle for flex entries. */ 442 uint32 flow_option_handle; /* FLOW option handle for flex entries. */ 443 bcm_flow_logical_field_t logical_fields[BCM_FLOW_MAX_NOF_LOGICAL_FIELDS]; /* logical fields array for flex 444 entries. */ 445 uint32 num_of_fields; /* number of logical fields. */ 446 bcm_qos_ingress_model_t ingress_qos_model; /* ingress qos and ttl model */ 447 bcm_qos_egress_model_t egress_qos_model; /* egress qos and ttl model */ 448 uint32 stat_id; /* Object statistics ID. */ 449 int stat_pp_profile; /* Statistics profile. */ 450 } bcm_l3_intf_t; 451 452 /* Invalid values for L3 ECMP dynamic load balancing parameters. */ 453 #define BCM_L3_ECMP_DYNAMIC_SCALING_FACTOR_INVALID -1 /* Invalid value for 454 dynamic_scaling_factor. */ 455 #define BCM_L3_ECMP_DYNAMIC_LOAD_WEIGHT_INVALID -1 /* Invalid value for 456 dynamic_load_weight. */ 457 #define BCM_L3_ECMP_DYNAMIC_QUEUE_SIZE_WEIGHT_INVALID -1 /* Invalid value for 458 dynamic_queue_size_weight. */ 459 460 /* L3 Ingress Interface URPF Mode setting. */ 461 typedef enum bcm_l3_ingress_urpf_mode_e { 462 bcmL3IngressUrpfDisable = 0, /* Disable unicast RPF. */ 463 bcmL3IngressUrpfLoose = 1, /* Loose mode Unicast RPF. */ 464 bcmL3IngressUrpfStrict = 2 /* Strict mode Unicast RPF. */ 465 } bcm_l3_ingress_urpf_mode_t; 466 467 /* 468 * L3 Egress Structure. 469 * 470 * Description of an L3 forwarding destination. 471 */ 472 typedef struct bcm_l3_egress_s { 473 uint32 flags; /* Interface flags (BCM_L3_TGID, 474 BCM_L3_L2TOCPU). */ 475 uint32 flags2; /* See BCM_L3_FLAGS2_xxx flag 476 definitions. */ 477 bcm_if_t intf; /* L3 interface (source MAC, tunnel). */ 478 bcm_mac_t mac_addr; /* Next hop forwarding destination mac. */ 479 bcm_vlan_t vlan; /* Next hop vlan id. */ 480 bcm_module_t module; 481 bcm_port_t port; /* Port packet switched to (if 482 !BCM_L3_TGID). */ 483 bcm_trunk_t trunk; /* Trunk packet switched to (if 484 BCM_L3_TGID). */ 485 uint32 mpls_flags; /* BCM_MPLS flag definitions. */ 486 bcm_mpls_label_t mpls_label; /* MPLS label. */ 487 bcm_mpls_egress_action_t mpls_action; /* MPLS action. */ 488 int mpls_qos_map_id; /* MPLS EXP map ID. */ 489 int mpls_ttl; /* MPLS TTL threshold. */ 490 uint8 mpls_pkt_pri; /* MPLS Packet Priority Value. */ 491 uint8 mpls_pkt_cfi; /* MPLS Packet CFI Value. */ 492 uint8 mpls_exp; /* MPLS Exp. */ 493 int qos_map_id; /* General QOS map id */ 494 bcm_if_t encap_id; /* Encapsulation index. */ 495 bcm_failover_t failover_id; /* Failover Object Index. */ 496 bcm_if_t failover_if_id; /* Failover Egress Object index. */ 497 bcm_multicast_t failover_mc_group; /* Failover Multicast Group. */ 498 int dynamic_scaling_factor; /* Scaling factor for dynamic load 499 balancing thresholds. */ 500 int dynamic_load_weight; /* Weight of traffic load in determining 501 a dynamic load balancing member's 502 quality. */ 503 int dynamic_queue_size_weight; /* Weight of queue size in determining a 504 dynamic load balancing member's 505 quality. */ 506 int intf_class; /* L3 interface class ID */ 507 uint32 multicast_flags; /* BCM_L3_MULTICAST flag definitions. */ 508 uint16 oam_global_context_id; /* OAM global context id passed from 509 ingress to egress XGS chip. */ 510 bcm_vntag_t vntag; /* VNTAG. */ 511 bcm_vntag_action_t vntag_action; /* VNTAG action. */ 512 bcm_etag_t etag; /* ETAG. */ 513 bcm_etag_action_t etag_action; /* ETAG action. */ 514 uint32 flow_handle; /* FLOW handle for flex entries. */ 515 uint32 flow_option_handle; /* FLOW option handle for flex entries. */ 516 uint32 flow_label_option_handle; /* FLOW option handle for egress label 517 flex entries. */ 518 bcm_flow_logical_field_t logical_fields[BCM_FLOW_MAX_NOF_LOGICAL_FIELDS]; /* logical fields array for flex 519 entries. */ 520 uint32 num_of_fields; /* number of logical fields. */ 521 int counting_profile; /* counting profile. If not required, 522 set it to 523 BCM_STAT_LIF_COUNTING_PROFILE_NONE */ 524 int mpls_ecn_map_id; /* IP ECN/INT CN to MPLS EXP map ID. */ 525 bcm_l3_ingress_urpf_mode_t urpf_mode; /* fec rpf mode. */ 526 bcm_multicast_t mc_group; /* Multicast Group. */ 527 bcm_mac_t src_mac_addr; /* Source MAC Address. */ 528 bcm_gport_t hierarchical_gport; /* Hierarchical TM-Flow. */ 529 uint32 stat_id; /* Object statistics ID. */ 530 int stat_pp_profile; /* Statistics profile. */ 531 bcm_gport_t vlan_port_id; /* Pointer to egress vlan translation 532 lif entry in EEDB. */ 533 int replication_id; /* Replication copy ID of multicast 534 Egress object. */ 535 } bcm_l3_egress_t; 536 537 /* 538 * L3 Ingress Structure. 539 * 540 * Description of an L3 Ingress interface. 541 */ 542 typedef struct bcm_l3_ingress_s { 543 uint32 flags; /* Interface flags. */ 544 bcm_vrf_t vrf; /* Virtual router id. */ 545 bcm_l3_ingress_urpf_mode_t urpf_mode; /* URPF mode setting for L3 Ingress 546 Interface. */ 547 int intf_class; /* Classification class ID. */ 548 bcm_vlan_t ipmc_intf_id; /* IPMC L2 distribution Vlan. */ 549 int qos_map_id; /* QoS DSCP priority map. */ 550 int ip4_options_profile_id; /* IP4 Options handling Profile ID */ 551 int nat_realm_id; /* Realm id of the interface for NAT */ 552 int tunnel_term_ecn_map_id; /* Tunnel termination ecn map id */ 553 uint32 intf_class_route_disable; /* routing enablers bit map in rif 554 profile */ 555 int oam_default_profile; /* OAM profile for RIF */ 556 } bcm_l3_ingress_t; 557 558 /* 559 * L3 Host Structure. 560 * 561 * Contains information required for manipulating L3 host table entries. 562 * 563 * The BCM_L3_IP6 flag in l3a_flags must be set to specify whether the 564 * IPv4 or IPv6 addresses are valid. 565 */ 566 typedef struct bcm_l3_host_s { 567 uint32 l3a_flags; /* See BCM_L3_xxx flag definitions. */ 568 uint32 l3a_flags2; /* See BCM_L3_FLAGS2_xxx flag 569 definitions. */ 570 bcm_vrf_t l3a_vrf; /* Virtual router instance. */ 571 bcm_ip_t l3a_ip_addr; /* Destination host IP address (IPv4). */ 572 bcm_ip6_t l3a_ip6_addr; /* Destination host IP address (IPv6). */ 573 bcm_cos_t l3a_pri; /* New priority in packet. */ 574 bcm_if_t l3a_intf; /* L3 intf associated with this address. */ 575 bcm_mac_t l3a_nexthop_mac; /* Next hop MAC addr. */ 576 bcm_module_t l3a_modid; /* Module ID packet is switched to. */ 577 bcm_port_t l3a_port_tgid; /* Port/TGID packet is switched to. */ 578 bcm_port_t l3a_stack_port; /* Used if modid not local (Strata 579 Only). */ 580 int l3a_ipmc_ptr; /* Pointer to IPMC table. */ 581 int l3a_lookup_class; /* Classification lookup class ID. */ 582 bcm_if_t encap_id; /* Encapsulation index. */ 583 bcm_if_t native_intf; /* L3 native interface (source MAC). */ 584 uint32 flow_handle; /* FLOW handle for flex entries. */ 585 uint32 flow_option_handle; /* FLOW option handle for flex entries. */ 586 bcm_flow_logical_field_t logical_fields[BCM_FLOW_MAX_NOF_LOGICAL_FIELDS]; /* logical fields array for flex 587 entries. */ 588 uint32 num_of_fields; /* number of logical fields. */ 589 int l3a_ipmc_ptr_l2; /* Pointer to IPMC table for L2 590 recipients if TTL/RPF check fails. */ 591 uint32 stat_id; /* Object statistics ID. */ 592 int stat_pp_profile; /* Statistics profile. */ 593 } bcm_l3_host_t; 594 595 /* Backward compatibility. */ 596 typedef bcm_l3_host_t bcm_l3_ip_t; 597 598 /* 599 * L3 Key Structure. 600 * 601 * Defines L3 table hash key structure. 602 * 603 * - For unicast addresses, key is DIP address or SIP to update HIT bit 604 * - For multicast addresses, the key is either IPMC group address 605 * (IPMC group address + src IP address), or 606 * (IPMC group address + src IP address + VID) 607 * depending on the chip being used and the (G, S, V) mode enable. 608 * 609 * The BCM_L3_IP6 flag in l3k_flags is set to specify whether the IPv4 or 610 * IPv6 addresses are valid. 611 */ 612 typedef struct bcm_l3_key_s { 613 uint32 l3k_flags; /* Set BCM_L3_IP6 for IPv6, default is IPv4, no 614 other flags are relevant. */ 615 bcm_ip_t l3k_ip_addr; /* Destination IP address (IPv4). */ 616 bcm_ip6_t l3k_ip6_addr; /* Destination IP address (IPv6). */ 617 bcm_ip_t l3k_sip_addr; /* Source IP address (IPv4). */ 618 bcm_ip6_t l3k_sip6_addr; /* Source IP address (IPv6). */ 619 bcm_vlan_t l3k_vid; /* VLAN ID. */ 620 bcm_vrf_t l3k_vrf; /* BCM5660x: Virtual router instance. */ 621 } bcm_l3_key_t; 622 623 /* 624 * L3 Route Structure 625 * 626 * Contains information required for manipulating L3 route table entries. 627 * 628 * The BCM_L3_IP6 flag in l3a_flags must be set to specify whether the 629 * IPv4 or IPv6 addresses are valid. 630 */ 631 typedef struct bcm_l3_route_s { 632 uint32 l3a_flags; /* See BCM_L3_xxx flag definitions. */ 633 uint32 l3a_flags2; /* See BCM_L3_FLAGS2_xxx flag 634 definitions. */ 635 uint32 l3a_ipmc_flags; /* Used for multicast route entry. See 636 BCM_IPMC_xxx flag definitions. */ 637 bcm_vrf_t l3a_vrf; /* Virtual router instance. */ 638 bcm_ip_t l3a_subnet; /* IP subnet address (IPv4). */ 639 bcm_ip6_t l3a_ip6_net; /* IP subnet address (IPv6). */ 640 bcm_ip_t l3a_ip_mask; /* IP subnet mask (IPv4). */ 641 bcm_ip6_t l3a_ip6_mask; /* IP subnet mask (IPv6). */ 642 bcm_if_t l3a_intf; /* L3 interface associated with route. */ 643 bcm_ip_t l3a_nexthop_ip; /* Next hop IP address (XGS1/2, IPv4). */ 644 bcm_mac_t l3a_nexthop_mac; /* Next hop MAC address. */ 645 bcm_module_t l3a_modid; /* Module ID. */ 646 bcm_port_t l3a_port_tgid; /* Port or trunk group ID. */ 647 bcm_port_t l3a_stack_port; /* Used if modid is not local (Strata 648 Only). */ 649 bcm_vlan_t l3a_vid; /* BCM5695 only - for per-VLAN def 650 route. */ 651 bcm_cos_t l3a_pri; /* Priority (COS). */ 652 uint32 l3a_tunnel_option; /* Tunnel option value. */ 653 bcm_mpls_label_t l3a_mpls_label; /* MPLS label. */ 654 int l3a_lookup_class; /* Classification class ID. */ 655 bcm_if_t l3a_expected_intf; /* Expected L3 Interface used for 656 multicast RPF check */ 657 int l3a_rp; /* Rendezvous point ID */ 658 bcm_multicast_t l3a_mc_group; /* L3 Multicast group index */ 659 bcm_gport_t l3a_expected_src_gport; /* L3 Multicast group expected source 660 port/trunk */ 661 uint32 flow_handle; /* FLOW handle for flex entries. */ 662 uint32 flow_option_handle; /* FLOW option handle for flex entries. */ 663 bcm_flow_logical_field_t logical_fields[BCM_FLOW_MAX_NOF_LOGICAL_FIELDS]; /* logical fields array for flex 664 entries. */ 665 uint32 num_of_fields; /* number of logical fields. */ 666 } bcm_l3_route_t; 667 668 /* 669 * L3 Information Structure. 670 * 671 * Contains information about L3 hardware capacity and utilization. 672 * 673 * Note that in chips that implement the longest prefix match route table 674 * as a trie, one IP route may consume up to 128 table entries in the 675 * worst case. 676 */ 677 typedef struct bcm_l3_info_s { 678 int l3info_max_vrf; /* Maximum number of virtual routers 679 allowed. */ 680 int l3info_used_vrf; /* Number of virtual routers created so far. */ 681 int l3info_max_intf; /* Maximum L3 interfaces the chip supports. */ 682 int l3info_max_intf_group; /* Maximum L3 interface groups the chip 683 supports. */ 684 int l3info_max_host; /* L3 host table size(unit is IPv4 unicast). */ 685 int l3info_max_route; /* L3 route table size (unit is IPv4 route). */ 686 int l3info_max_ecmp_groups; /* Maximum ECMP groups allowed. */ 687 int l3info_max_ecmp; /* Maximum ECMP paths allowed. */ 688 int l3info_used_intf; /* L3 interfaces used. */ 689 int l3info_used_host; /* L3 host entries used. */ 690 int l3info_used_route; /* L3 route entries used. */ 691 int l3info_max_lpm_block; /* Maximum LPM blocks. */ 692 int l3info_used_lpm_block; /* LPM blocks used. */ 693 int l3info_max_l3; /* Superseded by l3info_max_host. */ 694 int l3info_max_defip; /* Superseded by l3info_max_route. */ 695 int l3info_used_l3; /* Superseded by l3info_occupied_host. */ 696 int l3info_used_defip; /* Superseded by l3info_occupied_route. */ 697 int l3info_max_nexthop; /* Maximum NextHops. */ 698 int l3info_used_nexthop; /* NextHops used. */ 699 int l3info_max_tunnel_init; /* Maximum IPV4 tunnels that can be 700 initiated. */ 701 int l3info_used_tunnel_init; /* Number of active IPV4 tunnels initiated. */ 702 int l3info_max_tunnel_term; /* Maximum IPV4 tunnels that can be 703 terminated. */ 704 int l3info_used_tunnel_term; /* Number of active IPV4 tunnels terminated. */ 705 int l3info_used_host_ip4; /* L3 host entries used by IPv4. */ 706 int l3info_used_host_ip6; /* L3 host entries used by IPv6. */ 707 } bcm_l3_info_t; 708 709 /* Renamed bcm_l3_info_t fields. */ 710 #define l3info_occupied_intf l3info_used_intf 711 #define l3info_occupied_host l3info_used_host 712 #define l3info_occupied_route l3info_used_route 713 #define l3info_occupied_l3 l3info_used_l3 714 #define l3info_occupied_defip l3info_used_defip 715 #define bcm_l3_detach bcm_l3_cleanup 716 717 /* L3 DGM structure */ 718 typedef struct bcm_l3_dgm_s { 719 uint32 threshold; /* Indicates the primary path is always selected when 720 primary optimal quality band is above this threshold. */ 721 uint32 cost; /* Indicates the quality band cost of switching over to 722 alternate path. */ 723 uint32 bias; /* Indicates the quality band bias in favor of alternate 724 path. */ 725 } bcm_l3_dgm_t; 726 727 /* L3 ECMP URPF mode setting */ 728 typedef enum bcm_l3_ecmp_urpf_mode_e { 729 bcmL3EcmpUrpfInterfaceDefault = 0, /* Use the L3 interface URPF mode. */ 730 bcmL3EcmpUrpfLoose = 1, /* Use loose ECMP URPF mode. */ 731 bcmL3EcmpUrpfStrictEm = 2 /* Use strict EM ECMP RPF mode. */ 732 } bcm_l3_ecmp_urpf_mode_t; 733 734 /* L3 ECMP structure */ 735 typedef struct bcm_l3_egress_ecmp_s { 736 uint32 flags; /* See BCM_L3_xxx flag definitions. */ 737 bcm_if_t ecmp_intf; /* L3 interface ID pointing to egress 738 ecmp object. */ 739 int max_paths; /* Max number of paths in ECMP group. If 740 max_paths <= 0, the default max path 741 which can be set by the API 742 bcm_l3_route_max_ecmp_set will be 743 picked. */ 744 uint32 ecmp_group_flags; /* BCM_L3_ECMP_xxx flags. */ 745 uint32 dynamic_mode; /* Dynamic load balancing mode. See 746 BCM_L3_ECMP_DYNAMIC_MODE_xxx 747 definitions. */ 748 uint32 dynamic_size; /* Number of flows for dynamic load 749 balancing. Valid values are 512, 1k, 750 doubling up to 32k */ 751 uint32 dynamic_age; /* Inactivity duration, in microseconds. */ 752 uint32 dynamic_load_exponent; /* The exponent used in the 753 exponentially weighted moving average 754 calculation of historical member 755 load. */ 756 uint32 dynamic_expected_load_exponent; /* The exponent used in the 757 exponentially weighted moving average 758 calculation of historical expected 759 member load. */ 760 bcm_l3_dgm_t dgm; /* DGM properties */ 761 uint32 stat_id; /* Object statistics ID. */ 762 int stat_pp_profile; /* Statistics profile. */ 763 bcm_l3_ecmp_urpf_mode_t rpf_mode; /* Define RPF mode for the ECMP group. */ 764 } bcm_l3_egress_ecmp_t; 765 766 /* L3 ECMP member structure */ 767 typedef struct bcm_l3_ecmp_member_s { 768 uint32 flags; /* Member flag. */ 769 bcm_if_t egress_if; /* L3 interface ID pointing to Egress 770 Forwarding Object. */ 771 bcm_failover_t failover_id; /* Failover Object Identifier. */ 772 bcm_if_t failover_egress_if; /* Failover Egress L3 Interface ID. */ 773 int status; /* Member status. */ 774 } bcm_l3_ecmp_member_t; 775 776 /* Resilient ecmp entry */ 777 typedef struct bcm_l3_egress_ecmp_resilient_entry_s { 778 uint64 hash_key; /* Hash key. */ 779 bcm_l3_egress_ecmp_t ecmp; /* ECMP. */ 780 bcm_if_t intf; /* L3 interface. */ 781 } bcm_l3_egress_ecmp_resilient_entry_t; 782 783 /* 784 * Actions to take for DLB flow monitored packets. Currently supported 785 * for BCM5698x only 786 */ 787 #define BCM_L3_ECMP_DLB_MON_COPY_TO_CPU 1 /* Copy DLB monitored 788 packets to CPU */ 789 #define BCM_L3_ECMP_DLB_MON_MIRROR 2 /* Mirror DLB monitored 790 packets */ 791 #define BCM_L3_ECMP_DLB_MON_COPY_TO_CPU_AND_MIRROR 3 /* Perform Copy to CPU 792 and mirroring of DLB 793 monitored packets */ 794 #define BCM_L3_ECMP_DLB_MON_ACTION_NONE 4 /* Do not perform Copy to 795 CPU or mirroring(take 796 no action) */ 797 798 /* 799 * Per DLB configuration of monitoring parameters. Currently supported on 800 * BCM5698x only 801 */ 802 typedef struct bcm_l3_ecmp_dlb_mon_cfg_s { 803 uint32 sample_rate; /* Rate of sampling DLB monitored packets */ 804 int action; /* Either BCM_L3_ECMP_DLB_MON_COPY_TO_CPU or 805 BCM_L3_ECMP_DLB_MON_MIRROR or 806 BCM_L3_ECMP_DLB_MON_COPY_TO_CPU_AND_MIRROR or 807 BCM_L3_ECMP_DLB_MON_ACTION_NONE */ 808 int enable; /* Enable monitoring of DLB associated with the ECMP 809 group. 1 = Enable monitoring for DLB associated with 810 ecmp, 0 = Do not monitor DLB */ 811 } bcm_l3_ecmp_dlb_mon_cfg_t; 812 813 /* 814 * L3 ECMP flags. MSB is reserved and used internally for Resilient 815 * Hashing in 56960 816 */ 817 #define BCM_L3_ECMP_DYNAMIC_LOAD_DECREASE_RESET 0x01 /* If set, historical 818 member load is reset 819 to the instantaneous 820 member load if the 821 latter is smaller. */ 822 #define BCM_L3_ECMP_DYNAMIC_EXPECTED_LOAD_DECREASE_RESET 0x02 /* If set, historical 823 expected member load 824 is reset to the 825 instantaneous expected 826 member load if the 827 latter is smaller. */ 828 #define BCM_L3_ECMP_PATH_NO_SORTING 0x04 /* If set, the members of 829 the ECMP group won't 830 be resorted. */ 831 #define BCM_L3_ECMP_OVERLAY 0x08 /* If set, the members of 832 the ECMP group are 833 configured at ECMP 834 Level 1. */ 835 #define BCM_L3_ECMP_UNDERLAY 0x10 /* If set, the members of 836 the ECMP group are 837 configured at ECMP 838 Level 2. */ 839 #define BCM_L3_ECMP_LARGE_TABLE 0x20 /* If selected a large 840 members group table is 841 used for the resilient 842 hashing for better 843 member distribution. */ 844 #define BCM_L3_ECMP_WEIGHTED 0x40 /* If set, indicates it's 845 a weighted ECMP group 846 and members count 847 (intf_count) value 848 must be in powers-of-2 849 and supported values 850 are 256, 512, 1024, 851 2048 and 4096. */ 852 #define BCM_L3_ECMP_EXTENDED 0x80 /* Indicate ECMP extended 853 range (32k to 40k 854 values). */ 855 856 /* L3 ECMP dynamic load balancing modes. */ 857 #define BCM_L3_ECMP_DYNAMIC_MODE_DISABLED 0 /* ECMP dynamic load 858 balancing disabled. */ 859 #define BCM_L3_ECMP_DYNAMIC_MODE_NORMAL 1 /* ECMP dynamic load 860 balancing normal mode: 861 if inactivity duration 862 lapsed, use optimal 863 member, else use 864 assigned member. */ 865 #define BCM_L3_ECMP_DYNAMIC_MODE_ASSIGNED 2 /* ECMP dynamic load 866 balancing assigned 867 mode: always use 868 assigned member. */ 869 #define BCM_L3_ECMP_DYNAMIC_MODE_OPTIMAL 3 /* ECMP dynamic load 870 balancing optimal 871 mode: always use 872 optimal member */ 873 #define BCM_L3_ECMP_DYNAMIC_MODE_RESILIENT 4 /* ECMP resilient load 874 balancing mode: 875 minimize reassignment 876 of flows to members */ 877 #define BCM_L3_ECMP_DYNAMIC_MODE_RANDOM 5 /* ECMP Randomized load 878 balancing mode */ 879 #define BCM_L3_ECMP_DYNAMIC_MODE_ROUND_ROBIN 6 /* ECMP Round Robin load 880 balancing mode */ 881 #define BCM_L3_ECMP_DYNAMIC_MODE_DGM 7 /* ECMP dynamic group 882 multipath mode: if 883 primary path is good 884 enough, follow primary 885 path, else follow 886 alternate path. */ 887 888 /* L3 ECMP dynamic load balancing Ethertype eligibility flags. */ 889 #define BCM_L3_ECMP_DYNAMIC_ETHERTYPE_ELIGIBLE 0x01 /* If set, the specified 890 Ethertypes are 891 eligible, else 892 ineligible. */ 893 #define BCM_L3_ECMP_DYNAMIC_ETHERTYPE_INNER 0x02 /* Use packet's inner 894 Ethertype. */ 895 #define BCM_L3_ECMP_DYNAMIC_ETHERTYPE_RESILIENT 0x04 /* If set, configure 896 Ethertype eligibility 897 for resilient load 898 balancing, else for 899 dynamic load 900 balancing. */ 901 902 /* L3 ECMP dynamic load balancing link status. */ 903 #define BCM_L3_ECMP_DYNAMIC_MEMBER_FORCE_DOWN 0 /* Force down the link 904 status of an ECMP 905 dynamic load balancing 906 member. */ 907 #define BCM_L3_ECMP_DYNAMIC_MEMBER_FORCE_UP 1 /* Force up the link 908 status of an ECMP 909 dynamic load balancing 910 member. */ 911 #define BCM_L3_ECMP_DYNAMIC_MEMBER_HW 2 /* Let hardware determine 912 the link status of an 913 ECMP dynamic load 914 balancing member. */ 915 #define BCM_L3_ECMP_DYNAMIC_MEMBER_HW_DOWN 3 /* Hardware indicates 916 down link status of an 917 ECMP dynamic load 918 balancing member. */ 919 #define BCM_L3_ECMP_DYNAMIC_MEMBER_HW_UP 4 /* Hardware indicates up 920 link status of an ECMP 921 dynamic load balancing 922 member. */ 923 924 /* L3 ECMP Member Flags. */ 925 #define BCM_L3_ECMP_MEMBER_DGM_ALTERNATE 0x00000001 /* If set indicating ECMP 926 member is within 927 alternate path, else 928 within primary path */ 929 930 /* bcm_l3_host_traverse_cb */ 931 typedef int (*bcm_l3_host_traverse_cb)( 932 int unit, 933 int index, 934 bcm_l3_host_t *info, 935 void *user_data); 936 937 /* bcm_l3_route_traverse_cb */ 938 typedef int (*bcm_l3_route_traverse_cb)( 939 int unit, 940 int index, 941 bcm_l3_route_t *info, 942 void *user_data); 943 944 /* bcm_l3_egress_traverse_cb */ 945 typedef int (*bcm_l3_egress_traverse_cb)( 946 int unit, 947 bcm_if_t intf, 948 bcm_l3_egress_t *info, 949 void *user_data); 950 951 /* bcm_l3_ingress_traverse_cb */ 952 typedef int (*bcm_l3_ingress_traverse_cb)( 953 int unit, 954 bcm_if_t intf_id, 955 bcm_l3_ingress_t *ing_intf, 956 void *user_data); 957 958 /* bcm_l3_egress_multipath_traverse_cb */ 959 typedef int (*bcm_l3_egress_multipath_traverse_cb)( 960 int unit, 961 bcm_if_t mpintf, 962 int intf_count, 963 bcm_if_t *intf_array, 964 void *user_data); 965 966 /* bcm_l3_egress_ecmp_traverse_cb */ 967 typedef int (*bcm_l3_egress_ecmp_traverse_cb)( 968 int unit, 969 bcm_l3_egress_ecmp_t *ecmp, 970 int intf_count, 971 bcm_if_t *intf_array, 972 void *user_data); 973 974 /* bcm_l3_ecmp_traverse_cb */ 975 typedef int (*bcm_l3_ecmp_traverse_cb)( 976 int unit, 977 bcm_l3_egress_ecmp_t *ecmp_info, 978 int ecmp_member_count, 979 bcm_l3_ecmp_member_t *ecmp_member_array, 980 void *user_data); 981 982 #ifndef BCM_HIDE_DISPATCHABLE 983 984 /* Initialize the BCM L3 subsystem. */ 985 extern int bcm_l3_init( 986 int unit); 987 988 /* De-initialize the BCM L3 subsystem. */ 989 extern int bcm_l3_cleanup( 990 int unit); 991 992 #endif /* BCM_HIDE_DISPATCHABLE */ 993 994 #define bcm_l3_detach bcm_l3_cleanup 995 996 #ifndef BCM_HIDE_DISPATCHABLE 997 998 /* Enable/disable L3 function without clearing any L3 tables. */ 999 extern int bcm_l3_enable_set( 1000 int unit, 1001 int enable); 1002 1003 /* Get the status of hardware tables. */ 1004 extern int bcm_l3_info( 1005 int unit, 1006 bcm_l3_info_t *l3info); 1007 1008 #endif /* BCM_HIDE_DISPATCHABLE */ 1009 1010 /* Initialize a bcm_l3_intf_t/bcmx_l3_intf_t structure. */ 1011 extern void bcm_l3_intf_t_init( 1012 bcm_l3_intf_t *intf); 1013 1014 /* Initialize a bcm_l3_intf_qos_t structure. */ 1015 extern void bcm_l3_intf_qos_t_init( 1016 bcm_l3_intf_qos_t *intf_qos); 1017 1018 #ifndef BCM_HIDE_DISPATCHABLE 1019 1020 /* Create a new L3 interface. */ 1021 extern int bcm_l3_intf_create( 1022 int unit, 1023 bcm_l3_intf_t *intf); 1024 1025 /* Delete an L3 interface. */ 1026 extern int bcm_l3_intf_delete( 1027 int unit, 1028 bcm_l3_intf_t *intf); 1029 1030 /* Delete all L3 interfaces. */ 1031 extern int bcm_l3_intf_delete_all( 1032 int unit); 1033 1034 /* Search for L3 interface by MAC address and VLAN. */ 1035 extern int bcm_l3_intf_find( 1036 int unit, 1037 bcm_l3_intf_t *intf); 1038 1039 /* Search for L3 interface by VLAN only. */ 1040 extern int bcm_l3_intf_find_vlan( 1041 int unit, 1042 bcm_l3_intf_t *intf); 1043 1044 /* Given the L3 interface number, return the interface information. */ 1045 extern int bcm_l3_intf_get( 1046 int unit, 1047 bcm_l3_intf_t *intf); 1048 1049 #endif /* BCM_HIDE_DISPATCHABLE */ 1050 1051 /* Initialize a bcm_l3_egress_t/bcmx_l3_egress_t structure. */ 1052 extern void bcm_l3_egress_t_init( 1053 bcm_l3_egress_t *egr); 1054 1055 #ifndef BCM_HIDE_DISPATCHABLE 1056 1057 /* Create an Egress forwarding object. */ 1058 extern int bcm_l3_egress_create( 1059 int unit, 1060 uint32 flags, 1061 bcm_l3_egress_t *egr, 1062 bcm_if_t *if_id); 1063 1064 /* Destroy an Egress forwarding object. */ 1065 extern int bcm_l3_egress_destroy( 1066 int unit, 1067 bcm_if_t intf); 1068 1069 /* Get an Egress forwarding object. */ 1070 extern int bcm_l3_egress_get( 1071 int unit, 1072 bcm_if_t intf, 1073 bcm_l3_egress_t *egr); 1074 1075 /* Find an interface pinting to an Egress forwarding object. */ 1076 extern int bcm_l3_egress_find( 1077 int unit, 1078 bcm_l3_egress_t *egr, 1079 bcm_if_t *intf); 1080 1081 /* 1082 * Traverse through the egress object table and run callback at each 1083 * valid entry. 1084 */ 1085 extern int bcm_l3_egress_traverse( 1086 int unit, 1087 bcm_l3_egress_traverse_cb trav_fn, 1088 void *user_data); 1089 1090 /* 1091 * Traverse through the egress ARP object table and run callback at each 1092 * valid entry. 1093 */ 1094 extern int bcm_l3_egress_arp_traverse( 1095 int unit, 1096 bcm_l3_egress_traverse_cb trav_fn, 1097 void *user_data); 1098 1099 /* Create a Multipath Egress forwarding object. */ 1100 extern int bcm_l3_egress_multipath_create( 1101 int unit, 1102 uint32 flags, 1103 int intf_count, 1104 bcm_if_t *intf_array, 1105 bcm_if_t *mpintf); 1106 1107 /* Create a Multipath Egress forwarding object with specified path-width. */ 1108 extern int bcm_l3_egress_multipath_max_create( 1109 int unit, 1110 uint32 flags, 1111 int max_paths, 1112 int intf_count, 1113 bcm_if_t *intf_array, 1114 bcm_if_t *mpintf); 1115 1116 /* Destroy an Egress Multipath forwarding object. */ 1117 extern int bcm_l3_egress_multipath_destroy( 1118 int unit, 1119 bcm_if_t mpintf); 1120 1121 /* Get an Egress Multipath forwarding object. */ 1122 extern int bcm_l3_egress_multipath_get( 1123 int unit, 1124 bcm_if_t mpintf, 1125 int intf_size, 1126 bcm_if_t *intf_array, 1127 int *intf_count); 1128 1129 /* 1130 * Add an Egress forwarding object to an Egress Multipath forwarding 1131 * object. 1132 */ 1133 extern int bcm_l3_egress_multipath_add( 1134 int unit, 1135 bcm_if_t mpintf, 1136 bcm_if_t intf); 1137 1138 /* 1139 * Delete an Egress forwarding object from an Egress Multipath forwarding 1140 * object. 1141 */ 1142 extern int bcm_l3_egress_multipath_delete( 1143 int unit, 1144 bcm_if_t mpintf, 1145 bcm_if_t intf); 1146 1147 /* Find an interface pinting to an Egress Multipath forwarding object. */ 1148 extern int bcm_l3_egress_multipath_find( 1149 int unit, 1150 int intf_count, 1151 bcm_if_t *intf_array, 1152 bcm_if_t *mpintf); 1153 1154 /* 1155 * Traverse through the multipath egress object table and run callback at 1156 * each valid entry. 1157 */ 1158 extern int bcm_l3_egress_multipath_traverse( 1159 int unit, 1160 bcm_l3_egress_multipath_traverse_cb trav_fn, 1161 void *user_data); 1162 1163 #endif /* BCM_HIDE_DISPATCHABLE */ 1164 1165 /* Initialize a bcm_l3_egress_ecmp_t structure. */ 1166 extern void bcm_l3_egress_ecmp_t_init( 1167 bcm_l3_egress_ecmp_t *ecmp); 1168 1169 /* Initialize a bcm_l3_ecmp_member_t structure. */ 1170 extern void bcm_l3_ecmp_member_t_init( 1171 bcm_l3_ecmp_member_t *ecmp_member); 1172 1173 #ifndef BCM_HIDE_DISPATCHABLE 1174 1175 /* Create an Egress ECMP forwarding object. */ 1176 extern int bcm_l3_ecmp_create( 1177 int unit, 1178 uint32 options, 1179 bcm_l3_egress_ecmp_t *ecmp_info, 1180 int ecmp_member_count, 1181 bcm_l3_ecmp_member_t *ecmp_member_array); 1182 1183 /* Destroy an Egress ECMP forwarding object. */ 1184 extern int bcm_l3_ecmp_destroy( 1185 int unit, 1186 bcm_if_t ecmp_group_id); 1187 1188 /* Get an Egress ECMP forwarding object. */ 1189 extern int bcm_l3_ecmp_get( 1190 int unit, 1191 bcm_l3_egress_ecmp_t *ecmp_info, 1192 int ecmp_member_size, 1193 bcm_l3_ecmp_member_t *ecmp_member_array, 1194 int *ecmp_member_count); 1195 1196 /* Add a member to an Egress ECMP forwarding object. */ 1197 extern int bcm_l3_ecmp_member_add( 1198 int unit, 1199 bcm_if_t ecmp_group_id, 1200 bcm_l3_ecmp_member_t *ecmp_member); 1201 1202 /* Delete a member from an Egress ECMP forwarding object. */ 1203 extern int bcm_l3_ecmp_member_delete( 1204 int unit, 1205 bcm_if_t ecmp_group_id, 1206 bcm_l3_ecmp_member_t *ecmp_member); 1207 1208 /* Delete all members from an Egress ECMP forwarding object. */ 1209 extern int bcm_l3_ecmp_member_delete_all( 1210 int unit, 1211 bcm_if_t ecmp_group_id); 1212 1213 /* Find an interface pinting to an Egress ECMP forwarding object. */ 1214 extern int bcm_l3_ecmp_find( 1215 int unit, 1216 int ecmp_member_count, 1217 bcm_l3_ecmp_member_t *ecmp_member_array, 1218 bcm_l3_egress_ecmp_t *ecmp_info); 1219 1220 /* 1221 * Traverse through the ecmp egress object table and run callback at each 1222 * valid member. 1223 */ 1224 extern int bcm_l3_ecmp_traverse( 1225 int unit, 1226 bcm_l3_ecmp_traverse_cb trav_fn, 1227 void *user_data); 1228 1229 /* Attach already created AGM entry to a l3 ECMP group. */ 1230 extern int bcm_l3_ecmp_agm_attach( 1231 int unit, 1232 bcm_if_t l3_ecmp_id, 1233 bcm_switch_agm_id_t agm_id); 1234 1235 /* Detach already created AGM entry from a l3 ECMP group. */ 1236 extern int bcm_l3_ecmp_agm_detach( 1237 int unit, 1238 bcm_if_t l3_ecmp_id, 1239 bcm_switch_agm_id_t agm_id); 1240 1241 /* Retrieve a AGM id attached to a l3 ECMP group. */ 1242 extern int bcm_l3_ecmp_agm_attach_get( 1243 int unit, 1244 bcm_if_t l3_ecmp_id, 1245 bcm_switch_agm_id_t *agm_id); 1246 1247 /* Create an Egress ECMP forwarding object. */ 1248 extern int bcm_l3_egress_ecmp_create( 1249 int unit, 1250 bcm_l3_egress_ecmp_t *ecmp, 1251 int intf_count, 1252 bcm_if_t *intf_array); 1253 1254 /* Destroy an Egress ECMP forwarding object. */ 1255 extern int bcm_l3_egress_ecmp_destroy( 1256 int unit, 1257 bcm_l3_egress_ecmp_t *ecmp); 1258 1259 /* Get an Egress ECMP forwarding object. */ 1260 extern int bcm_l3_egress_ecmp_get( 1261 int unit, 1262 bcm_l3_egress_ecmp_t *ecmp, 1263 int intf_size, 1264 bcm_if_t *intf_array, 1265 int *intf_count); 1266 1267 /* Add an Egress forwarding object to an Egress ECMP forwarding object. */ 1268 extern int bcm_l3_egress_ecmp_add( 1269 int unit, 1270 bcm_l3_egress_ecmp_t *ecmp, 1271 bcm_if_t intf); 1272 1273 /* 1274 * Delete an Egress forwarding object from an Egress ECMP forwarding 1275 * object. 1276 */ 1277 extern int bcm_l3_egress_ecmp_delete( 1278 int unit, 1279 bcm_l3_egress_ecmp_t *ecmp, 1280 bcm_if_t intf); 1281 1282 /* Find an interface pinting to an Egress ECMP forwarding object. */ 1283 extern int bcm_l3_egress_ecmp_find( 1284 int unit, 1285 int intf_count, 1286 bcm_if_t *intf_array, 1287 bcm_l3_egress_ecmp_t *ecmp); 1288 1289 /* 1290 * Traverse through the ecmp egress object table and run callback at each 1291 * valid entry. 1292 */ 1293 extern int bcm_l3_egress_ecmp_traverse( 1294 int unit, 1295 bcm_l3_egress_ecmp_traverse_cb trav_fn, 1296 void *user_data); 1297 1298 /* Set Ethertype eligibility for ECMP dynamic load balancing */ 1299 extern int bcm_l3_egress_ecmp_ethertype_set( 1300 int unit, 1301 uint32 flags, 1302 int ethertype_count, 1303 int *ethertype_array); 1304 1305 /* Get Ethertype eligibility for ECMP dynamic load balancing */ 1306 extern int bcm_l3_egress_ecmp_ethertype_get( 1307 int unit, 1308 uint32 *flags, 1309 int ethertype_max, 1310 int *ethertype_array, 1311 int *ethertype_count); 1312 1313 /* Set ECMP member status */ 1314 extern int bcm_l3_egress_ecmp_member_status_set( 1315 int unit, 1316 bcm_if_t intf, 1317 int status); 1318 1319 /* Get ECMP member status */ 1320 extern int bcm_l3_egress_ecmp_member_status_get( 1321 int unit, 1322 bcm_if_t intf, 1323 int *status); 1324 1325 #endif /* BCM_HIDE_DISPATCHABLE */ 1326 1327 /* bcm_l3_egress_ecmp_resilient_traverse_cb */ 1328 typedef int (*bcm_l3_egress_ecmp_resilient_traverse_cb)( 1329 int unit, 1330 bcm_l3_egress_ecmp_resilient_entry_t *entry, 1331 void *user_data); 1332 1333 #ifndef BCM_HIDE_DISPATCHABLE 1334 1335 /* 1336 * Traverse through the resilient ecmp table and run callback at each 1337 * valid entry. Possible replacement of the matched entries 1338 */ 1339 extern int bcm_l3_egress_ecmp_resilient_traverse( 1340 int unit, 1341 uint32 flags, 1342 bcm_l3_egress_ecmp_resilient_entry_t *match_entry, 1343 bcm_l3_egress_ecmp_resilient_traverse_cb trav_fn, 1344 void *user_data); 1345 1346 /* Replace ECMP resilient entries matching given criteria */ 1347 extern int bcm_l3_egress_ecmp_resilient_replace( 1348 int unit, 1349 uint32 flags, 1350 bcm_l3_egress_ecmp_resilient_entry_t *match_entry, 1351 int *num_entries, 1352 bcm_l3_egress_ecmp_resilient_entry_t *replace_entry); 1353 1354 #endif /* BCM_HIDE_DISPATCHABLE */ 1355 1356 /* Initialize a bcm_l3_ingress_t/bcmx_l3_ingress_t structure. */ 1357 extern void bcm_l3_ingress_t_init( 1358 bcm_l3_ingress_t *ing_intf); 1359 1360 #ifndef BCM_HIDE_DISPATCHABLE 1361 1362 /* Create an L3 Ingress Interface. */ 1363 extern int bcm_l3_ingress_create( 1364 int unit, 1365 bcm_l3_ingress_t *ing_intf, 1366 bcm_if_t *intf_id); 1367 1368 /* Destroy an L3 Ingress Interface. */ 1369 extern int bcm_l3_ingress_destroy( 1370 int unit, 1371 bcm_if_t intf_id); 1372 1373 /* Get L3 Ingress Interface configuration. */ 1374 extern int bcm_l3_ingress_get( 1375 int unit, 1376 bcm_if_t intf, 1377 bcm_l3_ingress_t *ing_intf); 1378 1379 /* Find an identical ingress L3 interface. */ 1380 extern int bcm_l3_ingress_find( 1381 int unit, 1382 bcm_l3_ingress_t *ing_intf, 1383 bcm_if_t *intf_id); 1384 1385 /* 1386 * Traverse through the L3 ingress interfaces and invoke a user provide 1387 * callback for each valid entry. 1388 */ 1389 extern int bcm_l3_ingress_traverse( 1390 int unit, 1391 bcm_l3_ingress_traverse_cb trav_fn, 1392 void *user_data); 1393 1394 #endif /* BCM_HIDE_DISPATCHABLE */ 1395 1396 /* Initialize a bcm_l3_host_t/bcmx_l3_host_t structure. */ 1397 extern void bcm_l3_host_t_init( 1398 bcm_l3_host_t *ip); 1399 1400 #ifndef BCM_HIDE_DISPATCHABLE 1401 1402 /* Look up an L3 host table entry based on IP address. */ 1403 extern int bcm_l3_host_find( 1404 int unit, 1405 bcm_l3_host_t *info); 1406 1407 /* Add an entry into the L3 switching table. */ 1408 extern int bcm_l3_host_add( 1409 int unit, 1410 bcm_l3_host_t *info); 1411 1412 /* Delete an entry from the L3 host table. */ 1413 extern int bcm_l3_host_delete( 1414 int unit, 1415 bcm_l3_host_t *ip_addr); 1416 1417 /* Delete L3 entries based on IP prefix (network). */ 1418 extern int bcm_l3_host_delete_by_network( 1419 int unit, 1420 bcm_l3_route_t *ip_addr); 1421 1422 /* 1423 * Deletes L3 entries that match or do not match a specified L3 interface 1424 * number. 1425 */ 1426 extern int bcm_l3_host_delete_by_interface( 1427 int unit, 1428 bcm_l3_host_t *info); 1429 1430 /* Deletes all L3 host table entries. */ 1431 extern int bcm_l3_host_delete_all( 1432 int unit, 1433 bcm_l3_host_t *info); 1434 1435 /* Return list of conflicts in the L3 table. */ 1436 extern int bcm_l3_host_conflict_get( 1437 int unit, 1438 bcm_l3_key_t *ipkey, 1439 bcm_l3_key_t *cf_array, 1440 int cf_max, 1441 int *cf_count); 1442 1443 /* Run L3 table aging. */ 1444 extern int bcm_l3_host_age( 1445 int unit, 1446 uint32 flags, 1447 bcm_l3_host_traverse_cb age_cb, 1448 void *user_data); 1449 1450 /* Traverse through the L3 table and run callback at each valid L3 entry. */ 1451 extern int bcm_l3_host_traverse( 1452 int unit, 1453 uint32 flags, 1454 uint32 start, 1455 uint32 end, 1456 bcm_l3_host_traverse_cb cb, 1457 void *user_data); 1458 1459 /* bcm_l3_host_invalidate_entry */ 1460 extern int bcm_l3_host_invalidate_entry( 1461 int unit, 1462 bcm_ip_t info); 1463 1464 /* bcm_l3_host_validate_entry */ 1465 extern int bcm_l3_host_validate_entry( 1466 int unit, 1467 bcm_ip_t info); 1468 1469 #endif /* BCM_HIDE_DISPATCHABLE */ 1470 1471 /* Initialize a bcm_l3_route_t/bcmx_l3_route_t_init structure. */ 1472 extern void bcm_l3_route_t_init( 1473 bcm_l3_route_t *route); 1474 1475 #ifndef BCM_HIDE_DISPATCHABLE 1476 1477 /* Add an IP route to the L3 route table. */ 1478 extern int bcm_l3_route_add( 1479 int unit, 1480 bcm_l3_route_t *info); 1481 1482 /* Delete an IP route from the DEFIP table. */ 1483 extern int bcm_l3_route_delete( 1484 int unit, 1485 bcm_l3_route_t *info); 1486 1487 /* Delete routes based on matching or non-matching L3 interface number. */ 1488 extern int bcm_l3_route_delete_by_interface( 1489 int unit, 1490 bcm_l3_route_t *info); 1491 1492 /* Delete all routes. */ 1493 extern int bcm_l3_route_delete_all( 1494 int unit, 1495 bcm_l3_route_t *info); 1496 1497 /* Look up a route given the network and netmask. */ 1498 extern int bcm_l3_route_get( 1499 int unit, 1500 bcm_l3_route_t *info); 1501 1502 /* Given a network, return all the paths for this route. */ 1503 extern int bcm_l3_route_multipath_get( 1504 int unit, 1505 bcm_l3_route_t *the_route, 1506 bcm_l3_route_t *path_array, 1507 int max_path, 1508 int *path_count); 1509 1510 /* Age the route table. */ 1511 extern int bcm_l3_route_age( 1512 int unit, 1513 uint32 flags, 1514 bcm_l3_route_traverse_cb age_out, 1515 void *user_data); 1516 1517 /* Traverse through the routing table and run callback at each route. */ 1518 extern int bcm_l3_route_traverse( 1519 int unit, 1520 uint32 flags, 1521 uint32 start, 1522 uint32 end, 1523 bcm_l3_route_traverse_cb trav_fn, 1524 void *user_data); 1525 1526 /* Set the maximum ECMP paths allowed for a route (XGS only). */ 1527 extern int bcm_l3_route_max_ecmp_set( 1528 int unit, 1529 int max); 1530 1531 /* Get the maximum ECMP paths allowed for a route (XGS only). */ 1532 extern int bcm_l3_route_max_ecmp_get( 1533 int unit, 1534 int *max); 1535 1536 /* 1537 * Extract list of IPv6 prefixes which are forwarded based on lower 32 1538 * bit of IPv6 address, treated as IPv4 address. 1539 */ 1540 extern int bcm_l3_ip6_prefix_map_get( 1541 int unit, 1542 int map_size, 1543 bcm_ip6_t *ip6_array, 1544 int *ip6_count); 1545 1546 /* 1547 * Add IPv6 prefix to the list of prefixes which are forwarded based on 1548 * lower 32 bit of IPv6 address, treated as IPv4 address. 1549 */ 1550 extern int bcm_l3_ip6_prefix_map_add( 1551 int unit, 1552 bcm_ip6_t ip6_addr); 1553 1554 /* 1555 * Remove IPv6 prefix from the list of prefixes which are forwarded based 1556 * on lower 32 bit of IPv6 address, treated as IPv4 address. 1557 */ 1558 extern int bcm_l3_ip6_prefix_map_delete( 1559 int unit, 1560 bcm_ip6_t ip6_addr); 1561 1562 /* 1563 * Remove all the IPv6 prefixes from the list of prefixes which are 1564 * forwarded based on lower 32 bit of IPv6 address, treated as IPv4 1565 * address. 1566 */ 1567 extern int bcm_l3_ip6_prefix_map_delete_all( 1568 int unit); 1569 1570 #endif /* BCM_HIDE_DISPATCHABLE */ 1571 1572 /* bcm_l3_age_cb */ 1573 typedef void (*bcm_l3_age_cb)( 1574 int unit, 1575 bcm_ip_t ip); 1576 1577 /* Initialize a bcm_l3_key_t_init structure. */ 1578 extern void bcm_l3_key_t_init( 1579 bcm_l3_key_t *key); 1580 1581 /* Initialize a bcm_l3_info_t_init structure. */ 1582 extern void bcm_l3_info_t_init( 1583 bcm_l3_info_t *info); 1584 1585 /* Types of counters per L3 object. */ 1586 typedef enum bcm_l3_stat_e { 1587 bcmL3StatOutPackets = 0, 1588 bcmL3StatOutBytes = 1, 1589 bcmL3StatDropPackets = 2, 1590 bcmL3StatDropBytes = 3, 1591 bcmL3StatInPackets = 4, 1592 bcmL3StatInBytes = 5 1593 } bcm_l3_stat_t; 1594 1595 #ifndef BCM_HIDE_DISPATCHABLE 1596 1597 extern int bcm_l3_route_stat_get( 1598 int unit, 1599 bcm_l3_route_t *route, 1600 bcm_l3_stat_t stat, 1601 uint64 *val); 1602 1603 extern int bcm_l3_route_stat_get32( 1604 int unit, 1605 bcm_l3_route_t *route, 1606 bcm_l3_stat_t stat, 1607 uint32 *val); 1608 1609 extern int bcm_l3_route_stat_set( 1610 int unit, 1611 bcm_l3_route_t *route, 1612 bcm_l3_stat_t stat, 1613 uint64 val); 1614 1615 extern int bcm_l3_route_stat_set32( 1616 int unit, 1617 bcm_l3_route_t *route, 1618 bcm_l3_stat_t stat, 1619 uint32 val); 1620 1621 /* Enable/disable collection of statistics for the indicated L3 route. */ 1622 extern int bcm_l3_route_stat_enable_set( 1623 int unit, 1624 bcm_l3_route_t *route, 1625 int enable); 1626 1627 #endif /* BCM_HIDE_DISPATCHABLE */ 1628 1629 /* 1630 * This enum defines ALPM route associated data modes that are maintained 1631 * per L3 VRF. 1632 */ 1633 typedef enum bcm_l3_vrf_route_data_mode_e { 1634 bcmL3VrfRouteDataModeReduced = 0, /* Reduced ALPM route associated data 1635 mode on the L3 VRF */ 1636 bcmL3VrfRouteDataModeFull = 1 /* Full ALPM route associated data mode 1637 on the L3 VRF */ 1638 } bcm_l3_vrf_route_data_mode_t; 1639 1640 #ifndef BCM_HIDE_DISPATCHABLE 1641 1642 /* Get current ALPM route data mode for the selected VRF and IP type. */ 1643 extern int bcm_l3_vrf_route_data_mode_get( 1644 int unit, 1645 bcm_vrf_t vrf, 1646 uint32 flags, 1647 bcm_l3_vrf_route_data_mode_t *mode); 1648 1649 /* Set ALPM route data mode for the selected VRF and IP type. */ 1650 extern int bcm_l3_vrf_route_data_mode_set( 1651 int unit, 1652 bcm_vrf_t vrf, 1653 uint32 flags, 1654 bcm_l3_vrf_route_data_mode_t mode); 1655 1656 #endif /* BCM_HIDE_DISPATCHABLE */ 1657 1658 /* Types of statistics that are maintained per L3 VRF. */ 1659 typedef enum bcm_l3_vrf_stat_e { 1660 bcmL3VrfStatIngressPackets = 0, /* Packets that ingress on the L3 VRF */ 1661 bcmL3VrfStatIngressBytes = 1 /* Bytes that ingress on the L3 VRF */ 1662 } bcm_l3_vrf_stat_t; 1663 1664 #ifndef BCM_HIDE_DISPATCHABLE 1665 1666 /* Enable/disable packet and byte counters for the selected VRF. */ 1667 extern int bcm_l3_vrf_stat_enable_set( 1668 int unit, 1669 bcm_vrf_t vrf, 1670 int enable); 1671 1672 /* Get 64-bit counter value for specified VRF statistic type. */ 1673 extern int bcm_l3_vrf_stat_get( 1674 int unit, 1675 bcm_vrf_t vrf, 1676 bcm_l3_vrf_stat_t stat, 1677 uint64 *val); 1678 1679 /* Get 64-bit counter value for specified VRF statistic type. */ 1680 extern int bcm_l3_vrf_stat_sync_get( 1681 int unit, 1682 bcm_vrf_t vrf, 1683 bcm_l3_vrf_stat_t stat, 1684 uint64 *val); 1685 1686 /* Get lower 32-bit counter value for specified VRF statistic type. */ 1687 extern int bcm_l3_vrf_stat_get32( 1688 int unit, 1689 bcm_vrf_t vrf, 1690 bcm_l3_vrf_stat_t stat, 1691 uint32 *val); 1692 1693 /* Get lower 32-bit counter value for specified VRF statistic type. */ 1694 extern int bcm_l3_vrf_stat_sync_get32( 1695 int unit, 1696 bcm_vrf_t vrf, 1697 bcm_l3_vrf_stat_t stat, 1698 uint32 *val); 1699 1700 /* Provide stat counter ids associated with given vrf */ 1701 extern int bcm_l3_vrf_stat_id_get( 1702 int unit, 1703 bcm_vrf_t vrf, 1704 bcm_l3_vrf_stat_t stat, 1705 uint32 *stat_counter_id); 1706 1707 /* Set 64-bit counter value for specified VRF statistic type. */ 1708 extern int bcm_l3_vrf_stat_set( 1709 int unit, 1710 bcm_vrf_t vrf, 1711 bcm_l3_vrf_stat_t stat, 1712 uint64 val); 1713 1714 /* Set lower 32-bit counter value for specified VRF statistic type. */ 1715 extern int bcm_l3_vrf_stat_set32( 1716 int unit, 1717 bcm_vrf_t vrf, 1718 bcm_l3_vrf_stat_t stat, 1719 uint32 val); 1720 1721 /* Get 64-bit counter value for multiple VRF statistic types. */ 1722 extern int bcm_l3_vrf_stat_multi_get( 1723 int unit, 1724 bcm_vrf_t vrf, 1725 int nstat, 1726 bcm_l3_vrf_stat_t *stat_arr, 1727 uint64 *value_arr); 1728 1729 /* Get lower 32-bit counter value for multiple VRF statistic types. */ 1730 extern int bcm_l3_vrf_stat_multi_get32( 1731 int unit, 1732 bcm_vrf_t vrf, 1733 int nstat, 1734 bcm_l3_vrf_stat_t *stat_arr, 1735 uint32 *value_arr); 1736 1737 /* Set 64-bit counter value for multiple VRF statistic types. */ 1738 extern int bcm_l3_vrf_stat_multi_set( 1739 int unit, 1740 bcm_vrf_t vrf, 1741 int nstat, 1742 bcm_l3_vrf_stat_t *stat_arr, 1743 uint64 *value_arr); 1744 1745 /* Set lower 32-bit counter value for multiple VRF statistic types. */ 1746 extern int bcm_l3_vrf_stat_multi_set32( 1747 int unit, 1748 bcm_vrf_t vrf, 1749 int nstat, 1750 bcm_l3_vrf_stat_t *stat_arr, 1751 uint32 *value_arr); 1752 1753 #endif /* BCM_HIDE_DISPATCHABLE */ 1754 1755 #define BCM_L3_SOURCE_BIND_IP6 0x00000001 1756 #define BCM_L3_SOURCE_BIND_REPLACE 0x00000002 1757 #define BCM_L3_SOURCE_BIND_USE_MASK 0x00000004 1758 #define BCM_L3_SOURCE_BIND_PPPoE 0x00000008 1759 1760 /* L3 source binding information structure. */ 1761 typedef struct bcm_l3_source_bind_s { 1762 uint32 flags; /* BCM_L3_SOURCE_BIND_xxx flags. */ 1763 bcm_gport_t port; /* Source module and port, BCM_GPORT_INVALID 1764 to wildcard. */ 1765 bcm_ip_t ip; /* Source IPv4 address. */ 1766 bcm_ip6_t ip6; /* Source IPv6 address. */ 1767 bcm_mac_t mac; /* Source MAC address. */ 1768 bcm_ipfix_rate_id_t rate_id; /* IPFIX rate ID */ 1769 bcm_ip_t ip_mask; /* IP subnet mask (IPv4). */ 1770 bcm_ip6_t ip6_mask; /* IP subnet mask (IPv6). */ 1771 uint32 session_id; /* PPPoE session ID. */ 1772 } bcm_l3_source_bind_t; 1773 1774 /* Initialize a bcm_l3_source_bind_t structure. */ 1775 extern void bcm_l3_source_bind_t_init( 1776 bcm_l3_source_bind_t *info); 1777 1778 #ifndef BCM_HIDE_DISPATCHABLE 1779 1780 /* Enable or disable l3 source binding checks on an ingress port. */ 1781 extern int bcm_l3_source_bind_enable_set( 1782 int unit, 1783 bcm_port_t port, 1784 int enable); 1785 1786 /* 1787 * Retrieve whether l3 source binding checks are performed on an ingress 1788 * port. 1789 */ 1790 extern int bcm_l3_source_bind_enable_get( 1791 int unit, 1792 bcm_port_t port, 1793 int *enable); 1794 1795 /* Add or replace an L3 source binding. */ 1796 extern int bcm_l3_source_bind_add( 1797 int unit, 1798 bcm_l3_source_bind_t *info); 1799 1800 /* Remove an existing L3 source binding. */ 1801 extern int bcm_l3_source_bind_delete( 1802 int unit, 1803 bcm_l3_source_bind_t *info); 1804 1805 /* Remove all existing L3 source bindings. */ 1806 extern int bcm_l3_source_bind_delete_all( 1807 int unit); 1808 1809 /* Retrieve the details of an existing L3 source binding. */ 1810 extern int bcm_l3_source_bind_get( 1811 int unit, 1812 bcm_l3_source_bind_t *info); 1813 1814 #endif /* BCM_HIDE_DISPATCHABLE */ 1815 1816 typedef int (*bcm_l3_source_bind_traverse_cb)( 1817 int unit, 1818 bcm_l3_source_bind_t *info, 1819 void *user_data); 1820 1821 #ifndef BCM_HIDE_DISPATCHABLE 1822 1823 /* 1824 * Traverse through the L3 source bindings and run callback at each 1825 * defined binding. 1826 */ 1827 extern int bcm_l3_source_bind_traverse( 1828 int unit, 1829 bcm_l3_source_bind_traverse_cb cb, 1830 void *user_data); 1831 1832 /* 1833 * Add VRID for the given VSI. Adding a VRID using this API means the 1834 * physical node has become the master for the virtual router 1835 */ 1836 extern int bcm_l3_vrrp_add( 1837 int unit, 1838 bcm_vlan_t vlan, 1839 uint32 vrid); 1840 1841 /* Delete VRID for a particulat VLAN/VSI */ 1842 extern int bcm_l3_vrrp_delete( 1843 int unit, 1844 bcm_vlan_t vlan, 1845 uint32 vrid); 1846 1847 /* Delete all the VRIDs for a particular VLAN/VSI */ 1848 extern int bcm_l3_vrrp_delete_all( 1849 int unit, 1850 bcm_vlan_t vlan); 1851 1852 /* 1853 * Get all the VRIDs for which the physical node is master for the 1854 * virtual routers on the given VLAN/VSI 1855 */ 1856 extern int bcm_l3_vrrp_get( 1857 int unit, 1858 bcm_vlan_t vlan, 1859 int alloc_size, 1860 int *vrid_array, 1861 int *count); 1862 1863 /* Attach counters entries to the given VRF. */ 1864 extern int bcm_l3_vrf_stat_attach( 1865 int unit, 1866 bcm_vrf_t vrf, 1867 uint32 stat_counter_id); 1868 1869 /* Detach counters entries to the given VRF. */ 1870 extern int bcm_l3_vrf_stat_detach( 1871 int unit, 1872 bcm_vrf_t vrf); 1873 1874 /* Get L3 VRF counter value for specified VRF statistic type */ 1875 extern int bcm_l3_vrf_stat_counter_get( 1876 int unit, 1877 bcm_vrf_t vrf, 1878 bcm_l3_vrf_stat_t stat, 1879 uint32 num_entries, 1880 uint32 *counter_indexes, 1881 bcm_stat_value_t *counter_values); 1882 1883 /* Get L3 VRF counter value for specified VRF statistic type */ 1884 extern int bcm_l3_vrf_stat_counter_sync_get( 1885 int unit, 1886 bcm_vrf_t vrf, 1887 bcm_l3_vrf_stat_t stat, 1888 uint32 num_entries, 1889 uint32 *counter_indexes, 1890 bcm_stat_value_t *counter_values); 1891 1892 /* Set L3 VRF counter value for specified VRF statistic type */ 1893 extern int bcm_l3_vrf_stat_counter_set( 1894 int unit, 1895 bcm_vrf_t vrf, 1896 bcm_l3_vrf_stat_t stat, 1897 uint32 num_entries, 1898 uint32 *counter_indexes, 1899 bcm_stat_value_t *counter_values); 1900 1901 /* Attach counters entries to the given L3 Egress interface */ 1902 extern int bcm_l3_egress_stat_attach( 1903 int unit, 1904 bcm_if_t intf_id, 1905 uint32 stat_counter_id); 1906 1907 /* Detach counters entries to the given L3 Egress interface. */ 1908 extern int bcm_l3_egress_stat_detach( 1909 int unit, 1910 bcm_if_t intf_id); 1911 1912 /* Get the specified counter statistic for a L3 egress interface */ 1913 extern int bcm_l3_egress_stat_counter_get( 1914 int unit, 1915 bcm_if_t intf_id, 1916 bcm_l3_stat_t stat, 1917 uint32 num_entries, 1918 uint32 *counter_indexes, 1919 bcm_stat_value_t *counter_values); 1920 1921 /* Get the specified counter statistic for a L3 egress interface */ 1922 extern int bcm_l3_egress_stat_counter_sync_get( 1923 int unit, 1924 bcm_if_t intf_id, 1925 bcm_l3_stat_t stat, 1926 uint32 num_entries, 1927 uint32 *counter_indexes, 1928 bcm_stat_value_t *counter_values); 1929 1930 /* Provide stat counter ids associated with given L3 egress interface */ 1931 extern int bcm_l3_egress_stat_id_get( 1932 int unit, 1933 bcm_if_t intf_id, 1934 bcm_l3_stat_t stat, 1935 uint32 *stat_counter_id); 1936 1937 /* Set the specified counter statistic for a L3 egress interface */ 1938 extern int bcm_l3_egress_stat_counter_set( 1939 int unit, 1940 bcm_if_t intf_id, 1941 bcm_l3_stat_t stat, 1942 uint32 num_entries, 1943 uint32 *counter_indexes, 1944 bcm_stat_value_t *counter_values); 1945 1946 /* Attach counters entries to the given L3 Ingress interface */ 1947 extern int bcm_l3_ingress_stat_attach( 1948 int unit, 1949 bcm_if_t intf_id, 1950 uint32 stat_counter_id); 1951 1952 /* Detach counters entries to the given L3 Ingress interface. */ 1953 extern int bcm_l3_ingress_stat_detach( 1954 int unit, 1955 bcm_if_t intf_id); 1956 1957 /* Get the specified counter statistic for a L3 ingress interface */ 1958 extern int bcm_l3_ingress_stat_counter_get( 1959 int unit, 1960 bcm_if_t intf_id, 1961 bcm_l3_stat_t stat, 1962 uint32 num_entries, 1963 uint32 *counter_indexes, 1964 bcm_stat_value_t *counter_values); 1965 1966 /* Get the specified counter statistic for a L3 ingress interface */ 1967 extern int bcm_l3_ingress_stat_counter_sync_get( 1968 int unit, 1969 bcm_if_t intf_id, 1970 bcm_l3_stat_t stat, 1971 uint32 num_entries, 1972 uint32 *counter_indexes, 1973 bcm_stat_value_t *counter_values); 1974 1975 /* Provide stat counter ids associated with given L3 ingress interface */ 1976 extern int bcm_l3_ingress_stat_id_get( 1977 int unit, 1978 bcm_if_t intf_id, 1979 bcm_l3_stat_t stat, 1980 uint32 *stat_counter_id); 1981 1982 /* Set the specified counter statistic for a L3 ingress interface */ 1983 extern int bcm_l3_ingress_stat_counter_set( 1984 int unit, 1985 bcm_if_t intf_id, 1986 bcm_l3_stat_t stat, 1987 uint32 num_entries, 1988 uint32 *counter_indexes, 1989 bcm_stat_value_t *counter_values); 1990 1991 /* Attach counters entries to the given L3 host entry */ 1992 extern int bcm_l3_host_stat_attach( 1993 int unit, 1994 bcm_l3_host_t *info, 1995 uint32 stat_counter_id); 1996 1997 /* Detach counters entries to the given L3 host entry */ 1998 extern int bcm_l3_host_stat_detach( 1999 int unit, 2000 bcm_l3_host_t *info); 2001 2002 /* Get the specified counter statistic for a L3 host entry */ 2003 extern int bcm_l3_host_stat_counter_get( 2004 int unit, 2005 bcm_l3_host_t *info, 2006 bcm_l3_stat_t stat, 2007 uint32 num_entries, 2008 uint32 *counter_indexes, 2009 bcm_stat_value_t *counter_values); 2010 2011 /* Get the specified counter statistic for a L3 host entry */ 2012 extern int bcm_l3_host_stat_counter_sync_get( 2013 int unit, 2014 bcm_l3_host_t *info, 2015 bcm_l3_stat_t stat, 2016 uint32 num_entries, 2017 uint32 *counter_indexes, 2018 bcm_stat_value_t *counter_values); 2019 2020 /* Set the specified counter statistic for a L3 host entry */ 2021 extern int bcm_l3_host_stat_counter_set( 2022 int unit, 2023 bcm_l3_host_t *info, 2024 bcm_l3_stat_t stat, 2025 uint32 num_entries, 2026 uint32 *counter_indexes, 2027 bcm_stat_value_t *counter_values); 2028 2029 /* Provide stat counter ids associated with given L3 host entry */ 2030 extern int bcm_l3_host_stat_id_get( 2031 int unit, 2032 bcm_l3_host_t *info, 2033 bcm_l3_stat_t stat, 2034 uint32 *stat_counter_id); 2035 2036 #endif /* BCM_HIDE_DISPATCHABLE */ 2037 2038 /* L3 VRRP Flags. */ 2039 #define BCM_L3_VRRP_IPV4 0x00000001 /* VRID for IPV4 */ 2040 #define BCM_L3_VRRP_IPV6 0x00000002 /* VRID for IPV6 */ 2041 #define BCM_L3_VRRP_EXTENDED 0x00000004 /* Indicate extended memory usage for 2042 VRID */ 2043 2044 #ifndef BCM_HIDE_DISPATCHABLE 2045 2046 /* 2047 * Add VRID for the given VSI, for IPV4 or IPV6. Adding a VRID using this 2048 * API means the physical node has become the master for the virtual 2049 * router 2050 */ 2051 extern int bcm_l3_vrrp_config_add( 2052 int unit, 2053 uint32 flags, 2054 bcm_vlan_t vlan, 2055 uint32 vrid); 2056 2057 /* Delete VRID for a particulat VLAN/VSI, for IPV4 or IPV6 */ 2058 extern int bcm_l3_vrrp_config_delete( 2059 int unit, 2060 uint32 flags, 2061 bcm_vlan_t vlan, 2062 uint32 vrid); 2063 2064 /* Delete all the VRIDs for a particular VLAN/VSI, for IPV4 or IPV6 */ 2065 extern int bcm_l3_vrrp_config_delete_all( 2066 int unit, 2067 uint32 flags, 2068 bcm_vlan_t vlan); 2069 2070 /* 2071 * Get all the VRIDs for which the physical node is master for the 2072 * virtual routers on the given VLAN/VSI. VRIDs can be for IPV4 or IPV6 2073 */ 2074 extern int bcm_l3_vrrp_config_get( 2075 int unit, 2076 uint32 flags, 2077 bcm_vlan_t vlan, 2078 uint32 alloc_size, 2079 uint32 *vrid_array, 2080 uint32 *count); 2081 2082 #endif /* BCM_HIDE_DISPATCHABLE */ 2083 2084 /* L3 Route statistics maintained per route. */ 2085 typedef enum bcm_l3_route_stat_e { 2086 bcmL3RouteInPackets = 0, /* Packets that ingress on the l3 route */ 2087 bcmL3RouteInBytes = 1 /* Bytes that ingress on the l3 route */ 2088 } bcm_l3_route_stat_t; 2089 2090 #ifndef BCM_HIDE_DISPATCHABLE 2091 2092 /* Attach counter entries to the given l3 route. */ 2093 extern int bcm_l3_route_stat_attach( 2094 int unit, 2095 bcm_l3_route_t *info, 2096 uint32 stat_counter_id); 2097 2098 /* Detach counter entries to the given l3 route. */ 2099 extern int bcm_l3_route_stat_detach( 2100 int unit, 2101 bcm_l3_route_t *info); 2102 2103 /* Get L3 Route counter value for specified l3 route */ 2104 extern int bcm_l3_route_stat_counter_get( 2105 int unit, 2106 bcm_l3_route_t *info, 2107 bcm_l3_route_stat_t stat, 2108 uint32 num_entries, 2109 uint32 *counter_indexes, 2110 bcm_stat_value_t *counter_values); 2111 2112 /* Get L3 Route counter value for specified l3 route */ 2113 extern int bcm_l3_route_stat_counter_sync_get( 2114 int unit, 2115 bcm_l3_route_t *info, 2116 bcm_l3_route_stat_t stat, 2117 uint32 num_entries, 2118 uint32 *counter_indexes, 2119 bcm_stat_value_t *counter_values); 2120 2121 /* Set l3 route counter value for specified l3 route */ 2122 extern int bcm_l3_route_stat_counter_set( 2123 int unit, 2124 bcm_l3_route_t *info, 2125 bcm_l3_route_stat_t stat, 2126 uint32 num_entries, 2127 uint32 *counter_indexes, 2128 bcm_stat_value_t *counter_values); 2129 2130 /* Get 64-bit counter value for multiple route statistic types. */ 2131 extern int bcm_l3_route_stat_multi_get( 2132 int unit, 2133 bcm_l3_route_t *info, 2134 int nstat, 2135 bcm_l3_route_stat_t *stat_arr, 2136 uint64 *value_arr); 2137 2138 /* Get lower 32-bit counter value for multiple route statistic types. */ 2139 extern int bcm_l3_route_stat_multi_get32( 2140 int unit, 2141 bcm_l3_route_t *info, 2142 int nstat, 2143 bcm_l3_route_stat_t *stat_arr, 2144 uint32 *value_arr); 2145 2146 /* Set 64-bit counter value for multiple route statistic types. */ 2147 extern int bcm_l3_route_stat_multi_set( 2148 int unit, 2149 bcm_l3_route_t *info, 2150 int nstat, 2151 bcm_l3_route_stat_t *stat_arr, 2152 uint64 *value_arr); 2153 2154 /* Set lower 32-bit counter value for multiple route statistic types. */ 2155 extern int bcm_l3_route_stat_multi_set32( 2156 int unit, 2157 bcm_l3_route_t *info, 2158 int nstat, 2159 bcm_l3_route_stat_t *stat_arr, 2160 uint32 *value_arr); 2161 2162 /* Provide stat counter ids associated with given l3 route */ 2163 extern int bcm_l3_route_stat_id_get( 2164 int unit, 2165 bcm_l3_route_t *info, 2166 bcm_l3_route_stat_t stat, 2167 uint32 *stat_counter_id); 2168 2169 #endif /* BCM_HIDE_DISPATCHABLE */ 2170 2171 /* L3 IP options Flags. */ 2172 #define BCM_L3_IP4_OPTIONS_WITH_ID 0x00000001 /* With ID option creation */ 2173 #define BCM_L3_IP4_OPTIONS_REPLACE 0x00000002 /* Replace existing entry */ 2174 2175 /* L3 IP options handing actions. */ 2176 typedef enum bcm_l3_ip4_options_action_e { 2177 bcmIntfIPOptionActionNone = 0, /* No action. */ 2178 bcmIntfIPOptionActionCopyToCPU = 1, /* Copy to CPU action. */ 2179 bcmIntfIPOptionActionDrop = 2, /* Drop action. */ 2180 bcmIntfIPOptionActionCopyCPUAndDrop = 3 /* Copy to CPU and Drop action. */ 2181 } bcm_l3_ip4_options_action_t; 2182 2183 #ifndef BCM_HIDE_DISPATCHABLE 2184 2185 /* Create an IP Option handing Profile with a specified default action */ 2186 extern int bcm_l3_ip4_options_profile_create( 2187 int unit, 2188 uint32 flags, 2189 bcm_l3_ip4_options_action_t default_action, 2190 int *ip4_options_profile_id); 2191 2192 /* Destroy an IP Option handing Profile */ 2193 extern int bcm_l3_ip4_options_profile_destroy( 2194 int unit, 2195 int ip4_options_profile_id); 2196 2197 /* Set action to an IP option for a given IP Option Profile */ 2198 extern int bcm_l3_ip4_options_action_set( 2199 int unit, 2200 int ip4_options_profile_id, 2201 int ip4_option, 2202 bcm_l3_ip4_options_action_t action); 2203 2204 /* Retrieve action of an IP option for a given IP Option Profile */ 2205 extern int bcm_l3_ip4_options_action_get( 2206 int unit, 2207 int ip4_options_profile_id, 2208 int ip4_option, 2209 bcm_l3_ip4_options_action_t *action); 2210 2211 /* Find a longest prefix matched route given an IP address. */ 2212 extern int bcm_l3_route_find( 2213 int unit, 2214 bcm_l3_host_t *host, 2215 bcm_l3_route_t *route); 2216 2217 /* Find a longest prefix matched route given the ip and netmask. */ 2218 extern int bcm_l3_subnet_route_find( 2219 int unit, 2220 bcm_l3_route_t *input, 2221 bcm_l3_route_t *route); 2222 2223 #endif /* BCM_HIDE_DISPATCHABLE */ 2224 2225 /* L3 Multiple Egress Object related flags. */ 2226 #define BCM_L3_EGRESS_MULTI_WITH_ID (1 << 0) /* Create multiple egress objects 2227 with id. */ 2228 2229 /* Information to create multiple egress objects. */ 2230 typedef struct bcm_l3_egress_multi_info_s { 2231 uint32 flags; /* See BCM_L3_EGRESS_MULTI_XXX flag definitions. */ 2232 int number_of_elements; /* number of egress objects to allocate. */ 2233 } bcm_l3_egress_multi_info_t; 2234 2235 /* Initialize a egress multi structure. */ 2236 extern void bcm_l3_egress_multi_info_t_init( 2237 bcm_l3_egress_multi_info_t *egress_multi_info); 2238 2239 #ifndef BCM_HIDE_DISPATCHABLE 2240 2241 /* Allocate multiple egress objects. */ 2242 extern int bcm_l3_egress_multi_alloc( 2243 int unit, 2244 bcm_l3_egress_multi_info_t egress_multi_info, 2245 bcm_if_t *base_egress_id); 2246 2247 /* Free multiple egress objects. */ 2248 extern int bcm_l3_egress_multi_free( 2249 int unit, 2250 bcm_if_t base_egress_id); 2251 2252 /* Set the VPN on a given L3 Egress interface */ 2253 extern int bcm_l3_intf_vpn_set( 2254 int unit, 2255 bcm_if_t l3_intf_id, 2256 uint32 flags, 2257 bcm_vpn_t vpn); 2258 2259 /* Get the VPN on a given L3 Egress interface */ 2260 extern int bcm_l3_intf_vpn_get( 2261 int unit, 2262 bcm_if_t l3_intf_id, 2263 uint32 *flags, 2264 bcm_vpn_t *vpn); 2265 2266 #endif /* BCM_HIDE_DISPATCHABLE */ 2267 2268 /* 2269 * L3 vPBR Structure. Contains information required for manipulating L3 2270 * vPBR table entries 2271 */ 2272 typedef struct bcm_l3_vpbr_entry_s { 2273 uint32 flags; /* See BCM_L3_VPBR_xxx flag definitions. */ 2274 int priority; /* Entry priority. */ 2275 bcm_vrf_t vrf; /* Virtual Router instance. */ 2276 bcm_vrf_t vrf_mask; 2277 bcm_ip_t sip_addr; /* Source IP address (IPv4). */ 2278 bcm_ip_t sip_addr_mask; 2279 bcm_ip_t dip_addr; /* Destination IP address (IPv4). */ 2280 bcm_ip_t dip_addr_mask; 2281 bcm_ip6_t sip6_addr; /* Destination IP address (IPv6). */ 2282 bcm_ip6_t sip6_addr_mask; 2283 bcm_ip6_t dip6_addr; /* Destination IP address (IPv6). */ 2284 bcm_ip6_t dip6_addr_mask; 2285 int dscp; /* DSCP value */ 2286 int dscp_mask; 2287 uint32 src_port; /* TCP/UDP src port. */ 2288 uint32 src_port_mask; 2289 uint32 dst_port; /* TCP/UDP dst port. */ 2290 uint32 dst_port_mask; 2291 bcm_vrf_t new_vrf; /* The new result Virtual Router instance. */ 2292 bcm_if_t l3_intf_id; /* The relevant incoming interface . */ 2293 bcm_if_t l3_intf_id_mask; 2294 uint8 ip_protocol; /* IP protocol field. */ 2295 uint8 ip_protocol_mask; /* IP protocol field mask. */ 2296 } bcm_l3_vpbr_entry_t; 2297 2298 /* Initialize a bcm_l3_vpbr_entry_t structure. */ 2299 extern void bcm_l3_vpbr_entry_t_init( 2300 bcm_l3_vpbr_entry_t *vpbr_info); 2301 2302 /* L3 Flags. */ 2303 #define BCM_L3_VPBR_IP6 0x00000001 /* IPv6 entries */ 2304 2305 /* L3 vPBR Traverse cb type */ 2306 typedef int (*bcm_l3_vpbr_traverse_cb)( 2307 int unit, 2308 bcm_l3_vpbr_entry_t *entry, 2309 void *user_data); 2310 2311 #ifndef BCM_HIDE_DISPATCHABLE 2312 2313 /* 2314 * Traverse all L3 vPBR entries in DNX devices and call a function with 2315 * the data for each entry found. 2316 */ 2317 extern int bcm_l3_vpbr_traverse( 2318 int unit, 2319 uint32 flags, 2320 bcm_l3_vpbr_traverse_cb cb, 2321 void *user_data); 2322 2323 /* Delete an entry from the L3 vPBR table. */ 2324 extern int bcm_l3_vpbr_entry_delete( 2325 int unit, 2326 bcm_l3_vpbr_entry_t *entry); 2327 2328 /* Delete all L3 interfaces. */ 2329 extern int bcm_l3_vpbr_entry_delete_all( 2330 int unit, 2331 bcm_l3_vpbr_entry_t *entry); 2332 2333 /* Look up a L3 vPBR table entry. */ 2334 extern int bcm_l3_vpbr_entry_get( 2335 int unit, 2336 bcm_l3_vpbr_entry_t *entry); 2337 2338 /* Add an entry to the L3 vPBR table. */ 2339 extern int bcm_l3_vpbr_entry_add( 2340 int unit, 2341 bcm_l3_vpbr_entry_t *entry); 2342 2343 /* 2344 * Configure DLB monitoring parameters for a DLB id derived from ECMP 2345 * group id 2346 */ 2347 extern int bcm_l3_ecmp_dlb_mon_config_set( 2348 int unit, 2349 bcm_if_t ecmp_intf, 2350 bcm_l3_ecmp_dlb_mon_cfg_t *dlb_mon_cfg); 2351 2352 /* 2353 * Fetch DLB monitoring parameters for a DLB id derived from ECMP group 2354 * id 2355 */ 2356 extern int bcm_l3_ecmp_dlb_mon_config_get( 2357 int unit, 2358 bcm_if_t intf, 2359 bcm_l3_ecmp_dlb_mon_cfg_t *dlb_mon_cfg); 2360 2361 #endif /* BCM_HIDE_DISPATCHABLE */ 2362 2363 /* Initialize bcm_l3_ecmp_dlb_mon_t structure */ 2364 extern void bcm_l3_ecmp_dlb_mon_cfg_t_init( 2365 bcm_l3_ecmp_dlb_mon_cfg_t *dlb_mon_cfg); 2366 2367 #endif /* defined(INCLUDE_L3) */ 2368 2369 #endif /* __BCM_L3_H__ */