failover.h (8393B)
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_FAILOVER_H__ 14 #define __BCM_FAILOVER_H__ 15 16 #include <bcm/types.h> 17 #include <bcm/l3.h> 18 19 /* BCM_FAILOVER_* flags. */ 20 #define BCM_FAILOVER_WITH_ID (1 << 0) /* flag to create a failover 21 object whose Id is passed */ 22 #define BCM_FAILOVER_REPLACE (1 << 1) /* flag to update a failover 23 object whose Id is passed */ 24 #define BCM_FAILOVER_CLEAR (1 << 2) /* flag to clear the failover 25 state */ 26 #define BCM_FAILOVER_LOOKUP_DISABLE (1 << 3) /* flag to enable flooding by 27 disabling l2 lookup */ 28 #define BCM_FAILOVER_LEARN_DISABLE (1 << 4) /* flag to disable learning 29 while failover is in 30 progress */ 31 #define BCM_FAILOVER_ID_LOCAL -2 /* failover ID */ 32 #define BCM_FAILOVER_L2_LOOKUP (1 << 5) /* flag to create a failover 33 object for L2 lookup (fast 34 flush) */ 35 #define BCM_FAILOVER_PAIRED (1 << 6) /* flag to allocate a pair of 36 adjoining failover objects */ 37 #define BCM_FAILOVER_FEC (1 << 7) /* flag to create a FEC 38 failover object for 1:1 UC 39 Protection */ 40 #define BCM_FAILOVER_INGRESS (1 << 8) /* flag to create an Ingress 41 failover object for 1+1 42 Protection */ 43 #define BCM_FAILOVER_ENCAP (1 << 9) /* flag to create an 44 encapsulation failover 45 object for 1:1 MC 46 Protection */ 47 #define BCM_FAILOVER_VPN_TYPE (1 << 10) /* flag to use VPN ID for 48 failover */ 49 #define BCM_FAILOVER_MULTI_LEVEL_TYPE (1 << 11) /* flag to create multi level 50 failover */ 51 #define BCM_FAILOVER_FEC_2ND_HIERARCHY (1 << 12) /* flag to allocate failover 52 id to be used for FEC 53 second hierarchy */ 54 #define BCM_FAILOVER_FEC_3RD_HIERARCHY (1 << 13) /* flag to allocate failover 55 id to be used for FEC 56 third hierarchy */ 57 58 /* Invalid L3 Ingress Interface */ 59 #define BCM_FAILOVER_INVALID 0xFFFF /* Invalid Failover Index */ 60 61 /* Flags for Failover Elements */ 62 #define BCM_FAILOVER_ELEMENT_USE_SECONDARY (1 << 0) /* Use Secondary path */ 63 64 #if defined(INCLUDE_L3) 65 /* Failover Element Structure. */ 66 typedef struct bcm_failover_element_s { 67 uint32 flags; /* flags */ 68 uint32 element_flags; /* BCM_FAILOVER_ELEMENT_XXX flags */ 69 bcm_gport_t port; /* MPLS/MiM/VLAN gport */ 70 bcm_failover_t failover_id; /* Failover Object Index. */ 71 bcm_if_t intf; /* Egress Object index. */ 72 } bcm_failover_element_t; 73 #endif 74 75 #if defined(INCLUDE_L3) 76 /* Initialize the Failover element structure. */ 77 extern void bcm_failover_element_t_init( 78 bcm_failover_element_t *failover); 79 #endif 80 81 #ifndef BCM_HIDE_DISPATCHABLE 82 83 #if defined(INCLUDE_L3) 84 /* Initialize failover module. */ 85 extern int bcm_failover_init( 86 int unit); 87 #endif 88 89 #if defined(INCLUDE_L3) 90 /* Detach failover module. */ 91 extern int bcm_failover_cleanup( 92 int unit); 93 #endif 94 95 #if defined(INCLUDE_L3) 96 /* Create a failover object. */ 97 extern int bcm_failover_create( 98 int unit, 99 uint32 flags, 100 bcm_failover_t *failover_id); 101 #endif 102 103 #if defined(INCLUDE_L3) 104 /* Destroy a failover object. */ 105 extern int bcm_failover_destroy( 106 int unit, 107 bcm_failover_t failover_id); 108 #endif 109 110 #if defined(INCLUDE_L3) 111 /* 112 * Set a failover object to enable or disable (note that failover object 113 * 0 is reserved. 114 */ 115 extern int bcm_failover_set( 116 int unit, 117 bcm_failover_t failover_id, 118 int enable); 119 #endif 120 121 #if defined(INCLUDE_L3) 122 /* 123 * Set a failover object to enable or disable (note that failover object 124 * 0 is reserved. 125 */ 126 extern int bcm_failover_status_set( 127 int unit, 128 bcm_failover_element_t *failover, 129 int enable); 130 #endif 131 132 #if defined(INCLUDE_L3) 133 /* Get the enable status of a failover object. */ 134 extern int bcm_failover_get( 135 int unit, 136 bcm_failover_t failover_id, 137 int *enable); 138 #endif 139 140 #if defined(INCLUDE_L3) 141 /* 142 * Get a failover object to enable or disable (note that failover object 143 * 0 is reserved. 144 */ 145 extern int bcm_failover_status_get( 146 int unit, 147 bcm_failover_element_t *failover, 148 int *enable); 149 #endif 150 151 #endif /* BCM_HIDE_DISPATCHABLE */ 152 153 /* Failover Ring Structure. */ 154 typedef struct bcm_failover_ring_s { 155 uint32 flags; /* flags */ 156 bcm_vlan_vector_t vlan_vector; /* List of Vlans. */ 157 bcm_gport_t port0; /* VLAN gport */ 158 bcm_gport_t port1; /* VLAN gport */ 159 bcm_vpn_vector_t vpn_vector; /* List of VPN IDs. */ 160 } bcm_failover_ring_t; 161 162 /* Initialize the Failover ring structure. */ 163 extern void bcm_failover_ring_t_init( 164 bcm_failover_ring_t *failover); 165 166 #ifndef BCM_HIDE_DISPATCHABLE 167 168 /* Set the failover ring configuration. */ 169 extern int bcm_failover_ring_config_set( 170 int unit, 171 bcm_failover_ring_t *failover_ring); 172 173 /* Get the failover ring configuration. */ 174 extern int bcm_failover_ring_config_get( 175 int unit, 176 bcm_failover_ring_t *failover_ring); 177 178 #endif /* BCM_HIDE_DISPATCHABLE */ 179 180 #if defined(INCLUDE_L3) 181 /* Failover Multi Level Structure. */ 182 typedef struct bcm_failover_multi_level_s { 183 bcm_failover_t failover_id; /* parent failover id. */ 184 bcm_failover_t prot_group_1; /* First protection group for 2 level 185 failover. */ 186 bcm_failover_t prot_group_2; /* Second protection group for 2 level 187 failover. */ 188 } bcm_failover_multi_level_t; 189 #endif 190 191 #if defined(INCLUDE_L3) 192 /* Initialize multi level failover structure. */ 193 extern void bcm_failover_multi_level_t_init( 194 bcm_failover_multi_level_t *multi_level_failover); 195 #endif 196 197 #ifndef BCM_HIDE_DISPATCHABLE 198 199 #if defined(INCLUDE_L3) 200 /* Attaches multiples levels of failover. */ 201 extern int bcm_failover_multi_level_attach( 202 int unit, 203 bcm_failover_multi_level_t multi_level_failover); 204 #endif 205 206 #if defined(INCLUDE_L3) 207 /* 208 * Set a failover egress object with fixed offset to protect primary NH 209 * intf. 210 */ 211 extern int bcm_failover_egress_set( 212 int unit, 213 bcm_if_t intf, 214 bcm_l3_egress_t *failover_egr); 215 #endif 216 217 #if defined(INCLUDE_L3) 218 /* 219 * Get a failover egress object with fixed offset to protect primary NH 220 * intf. 221 */ 222 extern int bcm_failover_egress_get( 223 int unit, 224 bcm_if_t intf, 225 bcm_l3_egress_t *failover_egr); 226 #endif 227 228 #if defined(INCLUDE_L3) 229 /* 230 * Clear the failover egress object set earlier to protect primary NH 231 * intf. 232 */ 233 extern int bcm_failover_egress_clear( 234 int unit, 235 bcm_if_t intf); 236 #endif 237 238 #if defined(INCLUDE_L3) 239 /* 240 * Enable/Disable the use of failover egress protected NH for primary NH 241 * intf. 242 */ 243 extern int bcm_failover_egress_status_set( 244 int unit, 245 bcm_if_t intf, 246 int enable); 247 #endif 248 249 #if defined(INCLUDE_L3) 250 /* 251 * Get the current status of failover egress protection switching for 252 * primary NH intf. 253 */ 254 extern int bcm_failover_egress_status_get( 255 int unit, 256 bcm_if_t intf, 257 int *enable); 258 #endif 259 260 #endif /* BCM_HIDE_DISPATCHABLE */ 261 262 #endif /* __BCM_FAILOVER_H__ */