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 (3017B)


      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  * Module: Failover APIs
      8  *
      9  * Purpose:
     10  *     Failover API for Dune Soc_petra using PPD
     11  */
     12 #ifndef _BCM_INT_DPP_FAILOVER_H_
     13 #define _BCM_INT_DPP_FAILOVER_H_
     14 
     15 #include <bcm/types.h>
     16 #include <bcm/failover.h>
     17 
     18 
     19 /* Failover types to be used in order to distinguish between failover object types */
     20 #define DPP_FAILOVER_TYPE_NONE              (0)     /* No Failover type */
     21 #define DPP_FAILOVER_TYPE_L2_LOOKUP         (1)     /* L2 lookup (fast flush) FEC ID */
     22 #define DPP_FAILOVER_TYPE_FEC               (2)     /* Failover ID of type FEC (1:1 UC) */
     23 #define DPP_FAILOVER_TYPE_INGRESS           (3)     /* Failover ID of type Ingress (1+1) */
     24 #define DPP_FAILOVER_TYPE_ENCAP             (4)     /* Failover ID of type Egress (1:1 MC) */
     25 
     26 #define DPP_FAILOVER_TYPE_SHIFT             (29)
     27 #define DPP_FAILOVER_VAL_SHIFT              (0)
     28 #define DPP_FAILOVER_TYPE_MASK              (0x7)
     29 #define DPP_FAILOVER_VAL_MASK               (0x1FFFFFFF)
     30 
     31 #define DPP_FAILOVER_TYPE_GET(failover_type, failover_id)                               \
     32         ((failover_type) = (((failover_id) >> DPP_FAILOVER_TYPE_SHIFT) &                \
     33             DPP_FAILOVER_TYPE_MASK))                  \
     34 
     35 #define DPP_FAILOVER_IS_L2_LOOKUP(failover_id)                                          \
     36         (((((failover_id) >> DPP_FAILOVER_TYPE_SHIFT) & DPP_FAILOVER_TYPE_MASK) ==      \
     37                 DPP_FAILOVER_TYPE_L2_LOOKUP))
     38 
     39 #define DPP_FAILOVER_L2_LOOKUP_SET(failover_id, object_id)                              \
     40         ((failover_id) = ((DPP_FAILOVER_TYPE_L2_LOOKUP << DPP_FAILOVER_TYPE_SHIFT) |    \
     41          (((object_id) & DPP_FAILOVER_VAL_MASK) << DPP_FAILOVER_VAL_SHIFT)))
     42 
     43 #define DPP_FAILOVER_TYPE_SET(object_id, failover_id, failover_type)                    \
     44         ((object_id) = (((failover_type) << DPP_FAILOVER_TYPE_SHIFT) |                  \
     45          (((failover_id) & DPP_FAILOVER_VAL_MASK) << DPP_FAILOVER_VAL_SHIFT)))
     46 
     47 #define DPP_FAILOVER_TYPE_RESET(object_id, failover_id)                                 \
     48         ((object_id) = ((DPP_FAILOVER_TYPE_NONE << DPP_FAILOVER_TYPE_SHIFT) |           \
     49          (((failover_id) & DPP_FAILOVER_VAL_MASK) << DPP_FAILOVER_VAL_SHIFT)))
     50 
     51 #define DPP_FAILOVER_ID_GET(failover_id_val, failover_id)                               \
     52         ((failover_id_val) = (((failover_id) >> DPP_FAILOVER_VAL_SHIFT) &               \
     53             DPP_FAILOVER_VAL_MASK))
     54 
     55 typedef struct bcm_dpp_failover_info_s {
     56     uint8 id_sequence[SOC_DPP_DEFS_MAX(NOF_FAILOVER_EGRESS_IDS)];
     57 } bcm_dpp_failover_info_t;
     58 
     59 int _bcm_dpp_failover_is_valid_id(
     60     int unit,
     61     int32 failover_id,
     62     int32 failover_type_match);
     63 
     64 int _bcm_dpp_failover_state_hw_get(
     65     int unit,
     66     int32 failover_id,
     67     int32 failover_type,
     68     uint8 *failover_status);
     69 
     70 #endif /* _BCM_INT_DPP_FAILOVER_H_ */
     71 
     72