openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

failover.h (8557B)


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