tunnel.h (3421B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: tunnel.h 8 * Purpose: tunnel internal definitions to the BCM library. 9 */ 10 11 #ifndef _BCM_INT_DPP_TUNNEL_H_ 12 #define _BCM_INT_DPP_TUNNEL_H_ 13 14 15 /* tunnel subtype. 16 For example, for a tunnel type bcmTunnelTypeL2gre, subtype l2gre_is_erspan indicate we're building an IP tunnel for ERPSAN 17 subtype none indicate we're building an L2gre tunnel */ 18 typedef enum _bcm_tunnel_subtype_e { 19 _bcm_tunnel_subtype_none = 0, 20 _bcm_tunnel_subtype_l2gre_is_erspan = 1, /* IP_Tunnel.size will include erspan */ 21 _bcm_tunnel_subtype_gre_with_lb = 2 /* bcmTunnelTypeGreAnyIn4 will include LB key */ 22 } _bcm_tunnel_subtype_t; 23 24 25 26 int _bcm_ip_tunnel_sw_init(int unit); 27 int _bcm_ip_tunnel_sw_cleanup(int unit); 28 29 int bcm_petra_tunnel_initiator_data_set( 30 int unit, 31 bcm_l3_intf_t *intf, 32 bcm_tunnel_initiator_t *tunnel, 33 int vsi_param, 34 int ll_eep_param, 35 int *tunnel_eep 36 ); /* needed only in case intf is of type EEP */ 37 38 int 39 bcm_petra_data_entry_set( 40 int unit, 41 bcm_tunnel_initiator_t *tunnel); 42 43 int 44 bcm_petra_data_entry_clear( 45 int unit, 46 bcm_l3_intf_t *intf); 47 48 int 49 _bcm_petra_tunnel_initiator_set( 50 int unit, 51 bcm_l3_intf_t *intf, 52 bcm_tunnel_initiator_t *tunnel 53 ); 54 55 int 56 _bcm_petra_tunnel_terminator_add( 57 int unit, 58 bcm_tunnel_terminator_t *info) ; 59 60 int 61 _bcm_dpp_in_lif_tunnel_term_get(int unit, bcm_tunnel_terminator_t *tunnel_term, int lif); 62 63 /* see _bcm_petra_tunnel_ipv4_type_to_ppd comments */ 64 int 65 _bcm_petra_tunnel_ipv4_type_from_ppd(int unit, 66 SOC_PPC_EG_ENCAP_IPV4_ENCAP_INFO *ipv4_encap_info, 67 bcm_tunnel_type_t *tunnel_type, 68 _bcm_tunnel_subtype_t *tunnel_subtype); 69 70 71 /* 72 * setup template, encapsulation size and IP.protocol according to tunnel type 73 * supported From jericho B0 / QAX 74 */ 75 int 76 _bcm_petra_tunnel_ipv4_type_to_ppd_template(int unit, 77 bcm_tunnel_type_t tunnel_type, 78 _bcm_tunnel_subtype_t tunnel_subtype, 79 SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO *ip_tunnel_size_protocol_template); 80 81 /* 82 * resolve the ppd tunnel type to use. 83 * 84 * For Jericho A0 and below, tunnel type is bcmTunnelType. 85 * For Jericho B0 and above, tunnel type is composed of bcmTunnelType and tunnel_subtype. 86 * In most case there are no tunnel_subtype. 87 * Ex: 88 * For VxLAN: bcmTunnelType: bcmTunnelTypeVxlan and tunnel_subtype: _bcm_tunnel_subtype_none 89 * For Erspan: bcmTunnelType: bcmTunnelTypeL2Gre and tunnel_subtype: _bcm_tunnel_subtype_l2gre_is_erspan. 90 * tunnel_subtype indicates that the IP_Tunnel.size should include erspan. 91 */ 92 int 93 _bcm_petra_tunnel_ipv4_type_to_ppd(int unit, 94 bcm_tunnel_type_t tunnel_type, 95 _bcm_tunnel_subtype_t tunnel_subtype, 96 SOC_PPC_EG_ENCAP_IPV4_ENCAP_INFO *ipv4_encap_info, 97 uint32 is_replace); 98 99 #endif /* _BCM_INT_DPP_TUNNEL_H_ */