tunnel.h (31782B)
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_TUNNEL_H__ 11 #define __BCM_TUNNEL_H__ 12 13 #if defined(INCLUDE_L3) 14 15 #include <bcm/types.h> 16 #include <bcm/qos.h> 17 #include <bcm/l3.h> 18 19 /* Tunnel flags. */ 20 #define BCM_TUNNEL_TERM_DSCP_TRUST 0x00000001 /* Trust incoming tunnel 21 DSCP inner or outer 22 based on 23 USE_OUTER_DSCP flag. */ 24 #define BCM_TUNNEL_TERM_USE_OUTER_DSCP 0x00000002 /* Use outer header DSCP. */ 25 #define BCM_TUNNEL_TERM_USE_OUTER_TTL 0x00000004 /* Use outer header TTL. */ 26 #define BCM_TUNNEL_TERM_KEEP_INNER_DSCP 0x00000008 /* Keep inner header 27 DSCP. */ 28 #define BCM_TUNNEL_TERM_WLAN_REMOTE_TERMINATE 0x00000010 /* Remote WLAN tunnel 29 termination */ 30 #define BCM_TUNNEL_TERM_WLAN_SET_ROAM 0x00000020 /* Set wlan ha/fa roaming 31 model */ 32 #define BCM_TUNNEL_TERM_TUNNEL_WITH_ID 0x00000040 /* Create tunnel with ID */ 33 #define BCM_TUNNEL_TERM_RPF_FAIL_DROP 0x00000100 /* Drop packet on RPF 34 failure. */ 35 #define BCM_TUNNEL_TERM_L3_IIF_MISMATCH_DROP 0x00000200 /* Drop packet if 36 expected l3_iif 37 doesn't match incoming 38 l3_iif. */ 39 #define BCM_TUNNEL_TERM_L3_IIF_MISMATCH_TO_CPU 0x00000400 /* Copy to cpu if 40 expected l3_iif 41 doesn't match incoming 42 l3_iif. */ 43 #define BCM_TUNNEL_TERM_MICRO_SEGMENT_ID 0x00000800 /* Indicate that tunnel 44 is an SRv6 micro SID 45 tunnel. */ 46 #define BCM_TUNNEL_INIT_USE_INNER_DF 0x00000080 /* Copy DF from inner 47 header. Note:flag 48 takes precedence over 49 ipv4_set_df flag. */ 50 #define BCM_TUNNEL_INIT_IPV4_SET_DF 0x00000100 /* Set DF bit in outer 51 header if inner header 52 is IPv4. */ 53 #define BCM_TUNNEL_INIT_IPV6_SET_DF 0x00000200 /* Set DF bit in outer 54 header if inner header 55 is IPv6. */ 56 #define BCM_TUNNEL_INIT_IP4_ID_SET_FIXED 0x00000400 /* Use fixed starting ID 57 for IPv4 tunnel */ 58 #define BCM_TUNNEL_INIT_IP4_ID_SET_RANDOM 0x00000800 /* Use random starting ID 59 for IPv4 tunnel */ 60 #define BCM_TUNNEL_INIT_WLAN_MTU 0x00001000 /* Set MTU for outgoing 61 WLAN tunnel */ 62 #define BCM_TUNNEL_INIT_WLAN_FRAG_ENABLE 0x00002000 /* Enable Fragmentation 63 for WLAN Tunnel */ 64 #define BCM_TUNNEL_INIT_WLAN_VLAN_TAGGED 0x00004000 /* Set outgoing WLAN 65 tunnel vlan */ 66 #define BCM_TUNNEL_INIT_WLAN_TUNNEL_WITH_ID 0x00008000 /* Create outgoing tunnel 67 with ID */ 68 #define BCM_TUNNEL_REPLACE 0x00010000 /* Update existing 69 tunnel. */ 70 #define BCM_TUNNEL_TERM_ETHERNET 0x00020000 /* Terminate Ethernet 71 header after 72 terminated IP. */ 73 #define BCM_TUNNEL_TERM_UDP_CHECKSUM_ENABLE 0x00040000 /* Drop pkts with 74 non-zero UDP checksum. */ 75 #define BCM_TUNNEL_WITH_ID 0x00080000 /* Add using the 76 specified ID. */ 77 #define BCM_TUNNEL_TERM_TUNNEL_DEACTIVATE 0x00100000 /* Use to deactivate 78 tunnel terminator. */ 79 #define BCM_TUNNEL_TERM_WIDE 0x00200000 /* Use to create tuunel 80 terminator wide mode. */ 81 #define BCM_TUNNEL_TERM_USE_OUTER_PCP 0x00400000 /* Use outer header PCP. */ 82 #define BCM_TUNNEL_TERM_USE_TUNNEL_CLASS 0x00800000 /* Use tunnel class. */ 83 #define BCM_TUNNEL_INIT_GRE_KEY_USE_LB 0x01000000 /* GRE key presented and 84 include LB key, used 85 with bcmTunnelTypeGRE 86 tunnel types. */ 87 #define BCM_TUNNEL_TERM_ECN_MAP 0x02000000 /* Use to set tunnel 88 termination ecn map 89 id. */ 90 #define BCM_TUNNEL_INIT_USE_OUTER_TTL BCM_TUNNEL_TERM_USE_OUTER_TTL /* Use outer header TTL. */ 91 #define BCM_TUNNEL_INIT_WIDE 0x08000000 /* Use to create tunnel 92 encapsulation wide 93 mode. */ 94 #define BCM_TUNNEL_TERM_BUD 0x10000000 /* Use to create tunnel 95 termination for BUD 96 node. */ 97 #define BCM_TUNNEL_INIT_ERSPAN_TYPE3 0x20000000 /* Use to create ERSPANv3 98 tunnel. */ 99 #define BCM_TUNNEL_TERM_STAT_ENABLE 0x40000000 /* Enable statistics. */ 100 #define BCM_TUNNEL_INIT_STAT_ENABLE 0x80000000 /* Enable statistics. */ 101 #define BCM_TUNNEL_INIT_GRE_WITH_SN BCM_TUNNEL_TERM_ETHERNET /* GRE8 with Sequence 102 Number, used with 103 bcmTunnelTypeGreAnyIn4 104 tunnel type. */ 105 #define BCM_TUNNEL_TERM_EM BCM_TUNNEL_INIT_USE_INNER_DF /* Tunnel termination on 106 EM. */ 107 #define BCM_TUNNEL_INIT_SVTAG_ENABLE BCM_TUNNEL_INIT_IP4_ID_SET_FIXED /* Enable the SVTAG 108 lookup for the tunnel. */ 109 #define BCM_TUNNEL_TERM_USE_OUTER_QOS BCM_TUNNEL_TERM_USE_OUTER_DSCP /* Use outer header QoS. */ 110 #define BCM_TUNNEL_TERM_CROSS_CONNECT BCM_TUNNEL_INIT_WIDE /* Create tunnel 111 termination P2P L2/L3 112 service. */ 113 #define BCM_TUNNEL_TERM_EXTENDED_TERMINATION BCM_TUNNEL_INIT_GRE_KEY_USE_LB /* Used for extended 114 termination flow */ 115 #define BCM_TUNNEL_INIT_FIXED_UDP_SRC_PORT BCM_TUNNEL_TERM_DSCP_TRUST /* Use the source UDP 116 port in the tunnel 117 initiator. Or use the 118 hash entropy on the 119 private range [49152, 120 65535] by default. */ 121 #define BCM_TUNNEL_INIT_EVPN_ENABLE BCM_TUNNEL_TERM_KEEP_INNER_DSCP /* Enable EVPN on the 122 tunnel initiator. */ 123 #define BCM_TUNNEL_INIT_ERSPAN_WITH_SN BCM_TUNNEL_INIT_GRE_WITH_SN /* Enable sequence number 124 in the GRE header of a 125 ERSPAN tunnel. */ 126 127 #define BCM_TUNNEL_INIT_SET_DF \ 128 (BCM_TUNNEL_INIT_IPV6_SET_DF | \ 129 BCM_TUNNEL_INIT_IPV4_SET_DF) 130 131 /* Tunnel types. */ 132 typedef enum bcm_tunnel_type_e { 133 bcmTunnelTypeNone = 0, /* Disable IP tunneling on specific 134 interface. */ 135 bcmTunnelTypeIp4In4 = 1, /* RFC 2003/2893: IPv4-in-IPv4 tunnel. */ 136 bcmTunnelTypeIp6In4 = 2, /* RFC 2003/2893: IPv6-in-IPv4 tunnel. */ 137 bcmTunnelTypeIpAnyIn4 = 3, /* RFC 2003/2893: IPv6/4-in-IPv4 tunnel. */ 138 bcmTunnelTypeIp4In6 = 4, /* RFC 2003/2893: IPv4-in-IPv6 tunnel. */ 139 bcmTunnelTypeIp6In6 = 5, /* RFC 2003/2893: IPv6-in-IPv6 tunnel. */ 140 bcmTunnelTypeIpAnyIn6 = 6, /* RFC 2003/2893: IPv6/4-in-IPv6 tunnel. */ 141 bcmTunnelTypeGre4In4 = 7, /* RFC 1701/2784/2890: GRE IPv4-in-IPv4 142 tunnel. */ 143 bcmTunnelTypeGre6In4 = 8, /* RFC 1701/2784/2890: GRE IPv6-in-IPv4 144 tunnel. */ 145 bcmTunnelTypeGreAnyIn4 = 9, /* RFC 1701/2784/2890: GRE 146 IPv6/4-in-IPv4 tunnel. */ 147 bcmTunnelTypeGre4In6 = 10, /* RFC 1701/2784/2890: GRE IPv4-in-IPv6 148 tunnel. */ 149 bcmTunnelTypeGre6In6 = 11, /* RFC 1701/2784/2890: GRE IPv6-in-IPv6 150 tunnel. */ 151 bcmTunnelTypeGreAnyIn6 = 12, /* RFC 1701/2784/2890: GRE 152 IPv6/4-in-IPv6 tunnel. */ 153 bcmTunnelTypeIsatap = 13, /* RFC 4214: Intra-Site Automatic Tunnel 154 Addressing Protocol. */ 155 bcmTunnelType6In4Uncheck = 14, /* RFC 3056: Configured connection of 156 IPv6 Domains via IPv4. */ 157 bcmTunnelType6In4 = 15, /* RFC 3964: Checked 6to4 tunnel if 158 supported by device otherwise 159 unchecked 6to4 tunnel. */ 160 bcmTunnelTypeMpls = 16, /* RFC 3031: MPLS tunneling. */ 161 bcmTunnelTypeUdp = 17, /* UDP tunneling */ 162 bcmTunnelTypePimSmDr1 = 18, /* Broadcom PIM SM Tunnel */ 163 bcmTunnelTypePimSmDr2 = 19, /* Broadcom PIM SM Tunnel */ 164 bcmTunnelTypePim6SmDr1 = 20, /* Broadcom PIM6 SM Tunnel */ 165 bcmTunnelTypePim6SmDr2 = 21, /* Broadcom PIM6 SM Tunnel */ 166 bcmTunnelTypeWlanWtpToAc = 22, /* IPv4 WLAN WTP to AC tunnel */ 167 bcmTunnelTypeWlanAcToAc = 23, /* IPv4 WLAN AC to AC tunnel */ 168 bcmTunnelTypeWlanWtpToAc6 = 24, /* IPv6 WLAN WTP to AC tunnel */ 169 bcmTunnelTypeWlanAcToAc6 = 25, /* IPv6 WLAN AC to AC tunnel */ 170 bcmTunnelTypeAutoMulticast = 26, /* IPV4 171 draft-ietf-mboned-auto-multicast-09: 172 AMT */ 173 bcmTunnelTypeAutoMulticast6 = 27, /* IPV6 174 draft-ietf-mboned-auto-multicast-09: 175 AMT */ 176 bcmTunnelTypeEtherIp4In4 = 28, /* EoIP - Fixed encapsulation (2B) */ 177 bcmTunnelTypeL2Gre = 29, /* L2-GRE Tunnel */ 178 bcmTunnelTypeVxlan = 30, /* VXLAN Tunnel */ 179 bcmTunnelTypeErspan = 31, /* Erspan tunnel */ 180 bcmTunnelTypeRspan = 32, /* Rspan tunnel */ 181 bcmTunnelTypeL2EncapExternalCpu = 33, /* External CPU L2 tunnel */ 182 bcmTunnelTypeL2Flex = 34, /* Flex L2 tunnel, Flow API only */ 183 bcmTunnelTypeL3Flex = 35, /* Flex L3 tunnel, Flow API only */ 184 bcmTunnelTypeFlex = 36, /* Flex Generic tunnel, Flow API only */ 185 bcmTunnelTypeLawfulInterception = 37, /* Lawful Interception tunnel */ 186 bcmTunnelTypeVxlan6 = 38, /* VXLAN Tunnel */ 187 bcmTunnelTypeL2SrcEncap = 39, /* L2 Source Mac Encapsulation */ 188 bcmTunnelTypeRoeIn4 = 40, /* ROE frame Tunnel in IPv4 Header */ 189 bcmTunnelTypeRoeIn6 = 41, /* ROE Frame Tunnel in IPv6 Header */ 190 bcmTunnelTypeUdp6 = 42, /* Udp Tunnel */ 191 bcmTunnelTypeVxlanGpe = 43, /* VXLAN GPE Tunnel */ 192 bcmTunnelTypeVxlan6Gpe = 44, /* VXLAN GPE Tunnel */ 193 bcmTunnelTypeSR6 = 45, /* SRv6 Tunnel */ 194 bcmTunnelTypeRspanAdvanced = 46, /* RSPAN Advanced Tunnel */ 195 bcmTunnelTypeEsp = 47, /* ESP tunnel over IPv4 */ 196 bcmTunnelTypeEsp6 = 48, /* ESP tunnel over IPv6 */ 197 bcmTunnelTypeEthSR6 = 49, /* Ethernet over SRv6 tunnel */ 198 bcmTunnelTypeEthIn6 = 50, /* Ethernet over Ipv6 */ 199 bcmTunnelTypeCount = 51 /* Must be last */ 200 } bcm_tunnel_type_t; 201 202 #define BCM_TUNNEL_TYPE_STR \ 203 "None", \ 204 "Ip4In4", \ 205 "Ip6In4", \ 206 "IpAnyIn4", \ 207 "Ip4In6", \ 208 "Ip6In6", \ 209 "IpAnyIn6", \ 210 "Gre4In4", \ 211 "Gre6In4", \ 212 "GreAnyIn4", \ 213 "Gre4In6", \ 214 "Gre6In6", \ 215 "GreAnyIn6", \ 216 "Isatap", \ 217 "6In4Uncheck", \ 218 "6In4", \ 219 "Mpls", \ 220 "Udp", \ 221 "PimSmDr1", \ 222 "PimSmDr2", \ 223 "Pim6SmDr1", \ 224 "Pim6SmDr2", \ 225 "WlanWtpToAc", \ 226 "WlanAcToAc", \ 227 "WlanWtpToAc6", \ 228 "WlanAcToAc6", \ 229 "AutoMulticast", \ 230 "AutoMulticast6", \ 231 "EtherIp4In4", \ 232 "L2Gre", \ 233 "Vxlan", \ 234 "Erspan", \ 235 "Rspan", \ 236 "L2EncapExternalCpu", \ 237 "L2Flex", \ 238 "L3Flex", \ 239 "Flex", \ 240 "LawfulInterception", \ 241 "Vxlan6", \ 242 "L2SrcEncap", \ 243 "RoeIn4", \ 244 "RoeIn6", \ 245 "Udp6", \ 246 "VxlanGpe", \ 247 "Vxlan6Gpe", \ 248 "SR6", \ 249 "RspanAdvanced", \ 250 "Esp", \ 251 "Esp6", \ 252 "EthSR6", \ 253 "EthIn6" 254 255 /* L3 tunneling terminator. */ 256 typedef struct bcm_tunnel_terminator_s { 257 uint32 flags; /* Configuration flags. */ 258 uint32 multicast_flag; /* VXLAN Multicast trigger flags. */ 259 bcm_vrf_t vrf; /* Virtual router instance. */ 260 bcm_ip_t sip; /* SIP for tunnel header match. */ 261 bcm_ip_t dip; /* DIP for tunnel header match. */ 262 bcm_ip_t sip_mask; /* Source IP mask. */ 263 bcm_ip_t dip_mask; /* Destination IP mask. */ 264 bcm_ip6_t sip6; /* SIP for tunnel header match (IPv6). */ 265 bcm_ip6_t dip6; /* DIP for tunnel header match (IPv6). */ 266 bcm_ip6_t sip6_mask; /* Source IP mask (IPv6). */ 267 bcm_ip6_t dip6_mask; /* Destination IP mask (IPv6). */ 268 uint32 udp_dst_port; /* UDP dst port for UDP packets. */ 269 uint32 udp_src_port; /* UDP src port for UDP packets */ 270 bcm_tunnel_type_t type; /* Tunnel type */ 271 bcm_pbmp_t pbmp; /* Port bitmap for this tunnel */ 272 bcm_vlan_t vlan; /* The VLAN ID or L3 ingress interface 273 ID for IPMC lookup or WLAN tunnel */ 274 bcm_vlan_t fwd_vlan; /* VLAN ID for forwarding terminated IP 275 Tunnel */ 276 bcm_gport_t remote_port; /* Remote termination */ 277 bcm_gport_t tunnel_id; /* Tunnel id */ 278 int if_class; /* L3 interface class this tunnel. */ 279 bcm_multicast_t failover_mc_group; /* MC group used for bi-cast. */ 280 bcm_failover_t ingress_failover_id; /* 1+1 protection. */ 281 bcm_failover_t failover_id; /* Failover Object Identifier for 282 protected tunnel. */ 283 bcm_gport_t failover_tunnel_id; /* Failover Tunnel ID. */ 284 bcm_if_t tunnel_if; /* hierarchical interface. */ 285 int tunnel_class; /* Tunnel class id for VFP match. */ 286 int qos_map_id; /* QoS DSCP map this tunnel. */ 287 int inlif_counting_profile; /* In LIF counting profile */ 288 int tunnel_term_ecn_map_id; /* Tunnel termination ecn map id. */ 289 bcm_qos_ingress_model_t ingress_qos_model; /* ingress qos and ttl model */ 290 int priority; /* Entry priority. */ 291 int subport_pbmp_profile_id; /* profile id for allowed subports on 292 this tunnel. */ 293 bcm_if_t egress_if; /* Tunnel egress interface */ 294 bcm_vrf_t default_vrf; /* default virtual router instance. */ 295 } bcm_tunnel_terminator_t; 296 297 /* bcm_tunnel_dscp_ecn_select_e */ 298 typedef enum bcm_tunnel_dscp_ecn_select_e { 299 bcmTunnelDscpEcnAssign = 0, /* Set outer IP header DSCP and ECN to tunnel 300 initiator DSCP and ECN value. */ 301 bcmTunnelDscpEcnMap = 1, /* Use DSCP and ECN value from DSCP and ECN map. */ 302 bcmTunnelDscpEcnCount = 2 /* Unused always last. */ 303 } bcm_tunnel_dscp_ecn_select_t; 304 305 /* bcm_tunnel_dscp_select_e */ 306 typedef enum bcm_tunnel_dscp_select_e { 307 bcmTunnelDscpAssign = 0, /* Set outer IP header DSCP to tunnel initiator 308 DSCP value. */ 309 bcmTunnelDscpPacket = 1, /* Copy packet DSCP to outer header. */ 310 bcmTunnelDscpMap = 2, /* Use DSCP value from DSCP map. */ 311 bcmTunnelDscpCount = 3 /* Unused always last. */ 312 } bcm_tunnel_dscp_select_t; 313 314 /* bcm_tunnel_flow_label_select_e */ 315 typedef enum bcm_tunnel_flow_label_select_e { 316 bcmTunnelFlowLabelAssign = 0, /* Set outer IPv6 header flow label to 317 tunnel initiator flow label value. */ 318 bcmTunnelFlowLabelEntropy = 1, /* Set outer IPv6 header flow label to 319 entropy value. */ 320 bcmTunnelFlowLabelCount = 2 /* Unused always last. */ 321 } bcm_tunnel_flow_label_select_t; 322 323 /* L3 tunneling initiator. */ 324 typedef struct bcm_tunnel_initiator_s { 325 uint32 flags; /* Configuration flags. */ 326 bcm_tunnel_type_t type; /* Tunnel type. */ 327 int ttl; /* Tunnel header TTL. */ 328 bcm_mac_t dmac; /* Destination MAC address. */ 329 bcm_ip_t dip; /* Tunnel header DIP (IPv4). */ 330 bcm_ip_t sip; /* Tunnel header SIP (IPv4). */ 331 bcm_ip6_t sip6; /* Tunnel header SIP (IPv6). */ 332 bcm_ip6_t dip6; /* Tunnel header DIP (IPv6). */ 333 uint32 flow_label; /* Tunnel header flow label (IPv6). */ 334 bcm_tunnel_dscp_select_t dscp_sel; /* Tunnel header DSCP select. */ 335 int dscp; /* Tunnel header DSCP value. */ 336 int dscp_map; /* DSCP-map ID. */ 337 bcm_gport_t tunnel_id; /* Tunnel ID */ 338 uint16 udp_dst_port; /* Destination UDP port */ 339 uint16 udp_src_port; /* Source UDP port */ 340 bcm_mac_t smac; /* WLAN outer MAC */ 341 int mtu; /* WLAN MTU */ 342 bcm_vlan_t vlan; /* Tunnel VLAN */ 343 uint16 tpid; /* Tunnel TPID */ 344 uint8 pkt_pri; /* Tunnel priority */ 345 uint8 pkt_cfi; /* Tunnel CFI */ 346 uint16 ip4_id; /* IPv4 ID. */ 347 bcm_if_t l3_intf_id; /* l3 Interface ID. */ 348 uint16 span_id; /* Erspan Span ID. */ 349 uint32 aux_data; /* Tunnel associated data. */ 350 int outlif_counting_profile; /* Out LIF counting profile */ 351 bcm_encap_access_t encap_access; /* Encapsulation Access stage */ 352 uint8 hw_id; /* Unique identifier of an ERSPAN engine 353 within a system */ 354 uint16 switch_id; /* Identifies a source switch at the 355 receiving end */ 356 uint16 class_id; /* Class ID of the RSPAN advanced tunnel */ 357 bcm_qos_egress_model_t egress_qos_model; /* egress qos and ttl model */ 358 int qos_map_id; /* general remark profile */ 359 uint8 ecn; /* Tunnel header ECN value. */ 360 bcm_tunnel_flow_label_select_t flow_label_sel; /* Tunnel header flow label select. */ 361 bcm_tunnel_dscp_ecn_select_t dscp_ecn_sel; /* Tunnel header DSCP and ECN select. */ 362 int dscp_ecn_map; /* DSCP and ECN map ID. */ 363 int stat_cmd; /* Counter ID associated with the the 364 tunnel. */ 365 uint8 counter_command_id; /* Counter interface associated with the 366 tunnel. */ 367 } bcm_tunnel_initiator_t; 368 369 /* L3 Tunnel Configuration Structure. */ 370 typedef struct bcm_tunnel_config_s { 371 int ip4_id; /* Global ID. */ 372 uint32 ms_pimsm_hdr1; /* Most significant 32 bits of PIMSM-DR1 header */ 373 uint32 ls_pimsm_hdr1; /* Least significant 32 bits of PIMSM-DR1 header. */ 374 uint32 ms_pimsm_hdr2; /* Most significant 32 bits of PIMSM-DR2 header. */ 375 uint32 ls_pimsm_hdr2; /* Least significant 32 bits of PIMSM-DR2 header. */ 376 } bcm_tunnel_config_t; 377 378 /* Tunnel DSCP Map Structure. */ 379 typedef struct bcm_tunnel_dscp_map_s { 380 int priority; /* Internal priority. */ 381 bcm_color_t color; /* Color. */ 382 int dscp; /* DSCP value. */ 383 } bcm_tunnel_dscp_map_t; 384 385 /* tunnel_terminator_config_key */ 386 typedef struct bcm_tunnel_terminator_config_key_s { 387 uint32 flags; /* Configuration flags. */ 388 bcm_ip_t dip; /* DIP for tunnel header match. */ 389 bcm_ip_t dip_mask; /* Destination IP mask. */ 390 bcm_ip6_t dip6; /* DIP(IPv6) for tunnel header match. */ 391 bcm_ip6_t dip6_mask; /* Destination IP mask (IPv6). */ 392 bcm_tunnel_type_t type; /* Tunnel type. */ 393 uint16 udp_dst_port; /* Destination UDP port */ 394 bcm_vrf_t vrf; /* Virtual router instance. */ 395 } bcm_tunnel_terminator_config_key_t; 396 397 /* tunnel_terminator_config_action */ 398 typedef struct bcm_tunnel_terminator_config_action_s { 399 int tunnel_class; /* Tunnel class id for VTEP match. */ 400 } bcm_tunnel_terminator_config_action_t; 401 402 /* tunnel_terminator_config_traverse_info */ 403 typedef struct bcm_tunnel_terminator_config_traverse_info_s { 404 uint32 flags; /* Flags for tunnel terminator config. */ 405 } bcm_tunnel_terminator_config_traverse_info_t; 406 407 /* bcm_tunnel_initiator_traverse_cb */ 408 typedef int (*bcm_tunnel_initiator_traverse_cb)( 409 int unit, 410 bcm_tunnel_initiator_t *info, 411 void *user_data); 412 413 /* bcm_tunnel_terminator_traverse_cb */ 414 typedef int (*bcm_tunnel_terminator_traverse_cb)( 415 int unit, 416 bcm_tunnel_terminator_t *info, 417 void *user_data); 418 419 /* bcm_tunnel_terminator_config_traverse_cb */ 420 typedef int (*bcm_tunnel_terminator_config_traverse_cb)( 421 int unit, 422 bcm_tunnel_terminator_config_key_t *info, 423 void *user_data); 424 425 #ifndef BCM_HIDE_DISPATCHABLE 426 427 /* Set the tunneling initiator parameters on an L3 interface. */ 428 extern int bcm_tunnel_initiator_set( 429 int unit, 430 bcm_l3_intf_t *intf, 431 bcm_tunnel_initiator_t *tunnel); 432 433 /* Set the tunneling initiator parameters on an L3 interface. */ 434 extern int bcm_tunnel_initiator_create( 435 int unit, 436 bcm_l3_intf_t *intf, 437 bcm_tunnel_initiator_t *tunnel); 438 439 /* Delete the tunnel association for the given L3 interface. */ 440 extern int bcm_tunnel_initiator_clear( 441 int unit, 442 bcm_l3_intf_t *intf); 443 444 /* Get the tunnel property for the given L3 interface. */ 445 extern int bcm_tunnel_initiator_get( 446 int unit, 447 bcm_l3_intf_t *intf, 448 bcm_tunnel_initiator_t *tunnel); 449 450 /* Traverse Tunnel Initiator Info */ 451 extern int bcm_tunnel_initiator_traverse( 452 int unit, 453 bcm_tunnel_initiator_traverse_cb cb, 454 void *user_data); 455 456 /* Delete specific IP tunnel initiator. */ 457 extern int bcm_tunnel_initiator_destroy( 458 int unit, 459 bcm_gport_t tunnel_id); 460 461 /* Add a tunnel terminator for DIP-SIP key. */ 462 extern int bcm_tunnel_terminator_add( 463 int unit, 464 bcm_tunnel_terminator_t *info); 465 466 /* Add a tunnel terminator for DIP-SIP key. */ 467 extern int bcm_tunnel_terminator_create( 468 int unit, 469 bcm_tunnel_terminator_t *info); 470 471 /* Delete a tunnel terminator for DIP-SIP key. */ 472 extern int bcm_tunnel_terminator_delete( 473 int unit, 474 bcm_tunnel_terminator_t *info); 475 476 /* Update a tunnel terminator for DIP-SIP key. */ 477 extern int bcm_tunnel_terminator_update( 478 int unit, 479 bcm_tunnel_terminator_t *info); 480 481 /* Get a tunnel terminator for DIP-SIP key. */ 482 extern int bcm_tunnel_terminator_get( 483 int unit, 484 bcm_tunnel_terminator_t *info); 485 486 /* Traverse Tunnel Terminator Info */ 487 extern int bcm_tunnel_terminator_traverse( 488 int unit, 489 bcm_tunnel_terminator_traverse_cb cb, 490 void *user_data); 491 492 /* Traverse Tunnel Terminator Info */ 493 extern int bcm_tunnel_terminator_config_traverse( 494 int unit, 495 bcm_tunnel_terminator_config_traverse_info_t additional_info, 496 bcm_tunnel_terminator_config_traverse_cb cb, 497 void *user_data); 498 499 /* Set the valid payload VLANs for this WLAN tunnel. */ 500 extern int bcm_tunnel_terminator_vlan_set( 501 int unit, 502 bcm_gport_t tunnel, 503 bcm_vlan_vector_t vlan_vec); 504 505 /* Get the valid payload VLANs for this WLAN tunnel. */ 506 extern int bcm_tunnel_terminator_vlan_get( 507 int unit, 508 bcm_gport_t tunnel, 509 bcm_vlan_vector_t *vlan_vec); 510 511 /* Attach counters entries to the given tunnel. */ 512 extern int bcm_tunnel_terminator_stat_attach( 513 int unit, 514 bcm_tunnel_terminator_t *terminator, 515 uint32 stat_counter_id); 516 517 /* Detach counters entries to the given tunnel. */ 518 extern int bcm_tunnel_terminator_stat_detach( 519 int unit, 520 bcm_tunnel_terminator_t *terminator); 521 522 /* Get stat counter id associated with given tunnel. */ 523 extern int bcm_tunnel_terminator_stat_id_get( 524 int unit, 525 bcm_tunnel_terminator_t *terminator, 526 uint32 *stat_counter_id); 527 528 /* Set flex counter object value for the given tunnel. */ 529 extern int bcm_tunnel_terminator_flexctr_object_set( 530 int unit, 531 bcm_tunnel_terminator_t *terminator, 532 uint32 value); 533 534 /* Get flex counter object value for the given tunnel. */ 535 extern int bcm_tunnel_terminator_flexctr_object_get( 536 int unit, 537 bcm_tunnel_terminator_t *terminator, 538 uint32 *value); 539 540 /* Create a tunnel DSCP map instance. */ 541 extern int bcm_tunnel_dscp_map_create( 542 int unit, 543 uint32 flags, 544 int *dscp_map_id); 545 546 /* Destroy a tunnel DSCP map instance. */ 547 extern int bcm_tunnel_dscp_map_destroy( 548 int unit, 549 int dscp_map_id); 550 551 /* 552 * Get the { internal priority, color }-to-DSCP mapping in the specified 553 * DSCP map. 554 */ 555 extern int bcm_tunnel_dscp_map_get( 556 int unit, 557 int dscp_map_id, 558 bcm_tunnel_dscp_map_t *dscp_map); 559 560 /* 561 * Set the { internal priority, color }-to-DSCP mapping in the specified 562 * DSCP map. 563 */ 564 extern int bcm_tunnel_dscp_map_set( 565 int unit, 566 int dscp_map_id, 567 bcm_tunnel_dscp_map_t *dscp_map); 568 569 /* Set port egress { internal priority, color }-to-DSCP mapping. */ 570 extern int bcm_tunnel_dscp_map_port_set( 571 int unit, 572 bcm_port_t port, 573 bcm_tunnel_dscp_map_t *dscp_map); 574 575 /* Get port egress { internal priority, color }-to-DSCP mapping. */ 576 extern int bcm_tunnel_dscp_map_port_get( 577 int unit, 578 bcm_port_t port, 579 bcm_tunnel_dscp_map_t *dscp_map); 580 581 /* Set or get the global chip tunneling configuration. */ 582 extern int bcm_tunnel_config_get( 583 int unit, 584 bcm_tunnel_config_t *tconfig); 585 586 /* Set or get the global chip tunneling configuration. */ 587 extern int bcm_tunnel_config_set( 588 int unit, 589 bcm_tunnel_config_t *tconfig); 590 591 #endif /* BCM_HIDE_DISPATCHABLE */ 592 593 /* Initialize a bcm_tunnel_initiator_t. */ 594 extern void bcm_tunnel_initiator_t_init( 595 bcm_tunnel_initiator_t *tunnel_init); 596 597 /* Initialize a bcm_tunnel_terminator_t structure. */ 598 extern void bcm_tunnel_terminator_t_init( 599 bcm_tunnel_terminator_t *tunnel_term); 600 601 /* Initialize a bcm_tunnel_config_t structure. */ 602 extern void bcm_tunnel_config_t_init( 603 bcm_tunnel_config_t *tconfig); 604 605 /* Initialize a L3 tunnel bcm_tunnel_dscp_map_t structure. */ 606 extern void bcm_tunnel_dscp_map_t_init( 607 bcm_tunnel_dscp_map_t *dscp_info); 608 609 /* 610 * Initialize a tunnel L3 tunnel bcm_tunnel_terminator_config_key_t 611 * structure. 612 */ 613 extern void bcm_tunnel_terminator_config_key_t_init( 614 bcm_tunnel_terminator_config_key_t *config_key); 615 616 /* 617 * Initialize a tunnel L3 tunnel bcm_tunnel_terminator_config_action_t 618 * structure. 619 */ 620 extern void bcm_tunnel_terminator_config_action_t_init( 621 bcm_tunnel_terminator_config_action_t *config_action); 622 623 #ifndef BCM_HIDE_DISPATCHABLE 624 625 /* Add tunnel terminator config entries. */ 626 extern int bcm_tunnel_terminator_config_add( 627 int unit, 628 uint32 flags, 629 bcm_tunnel_terminator_config_key_t *config_key, 630 bcm_tunnel_terminator_config_action_t *config_action); 631 632 /* Get tunnel terminator config entries. */ 633 extern int bcm_tunnel_terminator_config_get( 634 int unit, 635 bcm_tunnel_terminator_config_key_t *config_key, 636 bcm_tunnel_terminator_config_action_t *config_action); 637 638 /* Delete tunnel terminator config entries. */ 639 extern int bcm_tunnel_terminator_config_delete( 640 int unit, 641 bcm_tunnel_terminator_config_key_t *config_key); 642 643 #endif /* BCM_HIDE_DISPATCHABLE */ 644 645 /* 646 * This structure aggregates all elements that we need to configure l3 647 * tunnel extention capability 648 */ 649 typedef struct bcm_l3_tunnel_term_extn_s { 650 uint8 extn_enable; /* This field specifes if l3 tunnel 651 termination extension is to be enabled or 652 is enabled */ 653 uint8 sip_mask_enable; /* This field specifes if l3 tunnel 654 termination extension sip mask is to be 655 enabled or is enabled */ 656 bcm_tunnel_type_t tnl_type1; /* This field represents the l3 tunnel type 657 to match */ 658 bcm_tunnel_type_t tnl_type2; /* This field represents the l3 tunnel type 659 to match, alternatively */ 660 uint16 dip_mask; /* This field specifes l3 tunnel termination 661 extension - dip mask to apply to ingress 662 tunneled packet before matching */ 663 } bcm_l3_tunnel_term_extn_t; 664 665 /* initialize a bcm_l3_tunnel_term_extn_t structure. */ 666 extern void bcm_l3_tunnel_term_extn_t_init( 667 bcm_l3_tunnel_term_extn_t *extn_attribute); 668 669 #ifndef BCM_HIDE_DISPATCHABLE 670 671 /* return the configured l3 tunnel termination global attributes. */ 672 extern int bcm_l3_tunnel_term_global_cfg_get( 673 int unit, 674 bcm_l3_tunnel_term_extn_t *extn_attribute); 675 676 /* configure l3 tunnel termination global attributes. */ 677 extern int bcm_l3_tunnel_term_global_cfg_set( 678 int unit, 679 bcm_l3_tunnel_term_extn_t *extn_attribute); 680 681 #endif /* defined(INCLUDE_L3) */ 682 683 #endif /* BCM_HIDE_DISPATCHABLE */ 684 685 #endif /* __BCM_TUNNEL_H__ */