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

ha.h (4476B)


      1 /*! \file ha.h
      2  *
      3  * ltsw HA definitions.
      4  */
      5 /*
      6  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      7  * 
      8  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      9  */
     10 
     11 #ifndef BCM_INT_LTSW_HA_H
     12 #define BCM_INT_LTSW_HA_H
     13 
     14 #include <sal/sal_types.h>
     15 #include <shr/shr_ha.h>
     16 
     17 /*!
     18  * The HA memory blocks are distinguished by component-ID and sub-component-ID,
     19  * which then are used to retrieve the same memory content that was held prior
     20  * to the boot during warm boot procedure.
     21  */
     22 
     23 /*! Component ID of each module in BCM API Emulator (BAE). */
     24 typedef enum {
     25     BCMI_HA_COMP_ID_L2 = 0,
     26     BCMI_HA_COMP_ID_TRUNK = 1,
     27     BCMI_HA_COMP_ID_FLEXCTR = 2,
     28     BCMI_HA_COMP_ID_ISSU = 3,
     29     BCMI_HA_COMP_ID_L3_INTF = 4,
     30     BCMI_HA_COMP_ID_MIRROR = 5,
     31     BCMI_HA_COMP_ID_MULTICAST = 6,
     32     BCMI_HA_COMP_ID_STG = 7,
     33     BCMI_HA_COMP_ID_FLOW = 8,
     34     BCMI_HA_COMP_ID_VLAN = 9,
     35     BCMI_HA_COMP_ID_DLB = 10,
     36     BCMI_HA_COMP_ID_SWITCH = 11,
     37     BCMI_HA_COMP_ID_ECN = 12,
     38     BCMI_HA_COMP_ID_STACK = 13,
     39     BCMI_HA_COMP_ID_COSQ = 14,
     40     BCMI_HA_COMP_ID_PROPERTY = 15,
     41     BCMI_HA_COMP_ID_QOS = 16,
     42     BCMI_HA_COMP_ID_FLOWTRACKER = 17,
     43     BCMI_HA_COMP_ID_PORT = 18,
     44     BCMI_HA_COMP_ID_L3_EGR = 19,
     45     BCMI_HA_COMP_ID_FLEXDIGEST = 20,
     46     BCMI_HA_COMP_ID_COLLECTOR = 21,
     47     BCMI_HA_COMP_ID_L3_FIB = 22,
     48     BCMI_HA_COMP_ID_TELEMETRY = 23,
     49     BCMI_HA_COMP_ID_L3 = 24,
     50     BCMI_HA_COMP_ID_VIRTUAL = 25,
     51     BCMI_HA_COMP_ID_PKTIO = 26,
     52     BCMI_HA_COMP_ID_FIELD = 27,
     53     BCMI_HA_COMP_ID_POLICER = 28,
     54     BCMI_HA_COMP_ID_FLEXSTATE = 29,
     55     BCMI_HA_COMP_ID_LINK = 30,
     56     BCMI_HA_COMP_ID_BFD = 31,
     57     BCMI_HA_COMP_ID_IPMC = 32,
     58     BCMI_HA_COMP_ID_MPLS = 33,
     59     BCMI_HA_COMP_ID_UDF = 34,
     60     BCMI_HA_COMP_ID_LB_HASH = 35,
     61     BCMI_HA_COMP_ID_SEQ_NUM = 36,
     62     BCMI_HA_COMP_ID_IFA = 37,
     63     BCMI_HA_COMP_ID_INT = 38,
     64     BCMI_HA_COMP_ID_XFLOW_MACSEC = 39,
     65     BCMI_HA_COMP_ID_MAX /* Support up to 255 */
     66 } bcmi_ha_comp_id_t;
     67 
     68 #define BCMI_HA_COMP_ID_STRINGS { \
     69     "L2", \
     70     "TRUNK", \
     71     "FLEXCTR", \
     72     "ISSU", \
     73     "L3_INTF", \
     74     "MIRROR", \
     75     "MULTICAST", \
     76     "STG", \
     77     "FLOW", \
     78     "VLAN", \
     79     "DLB", \
     80     "SWITCH", \
     81     "ECN", \
     82     "STACK", \
     83     "COSQ", \
     84     "PROPERTY", \
     85     "QOS", \
     86     "FLOWTRACKER", \
     87     "PORT", \
     88     "L3_EGR", \
     89     "FLEXDIGEST", \
     90     "COLLECTOR", \
     91     "L3_FIB", \
     92     "TELEMETRY", \
     93     "L3", \
     94     "VIRTUAL", \
     95     "PKTIO", \
     96     "FIELD", \
     97     "POLICER", \
     98     "FLEXSTATE", \
     99     "LINK", \
    100     "BFD", \
    101     "IPMC", \
    102     "MPLS", \
    103     "UDF", \
    104     "LB_HASH", \
    105     "SEQNUM", \
    106     "IFA", \
    107     "INT", \
    108     "XFLOW_MACSEC", \
    109     "UNKNOWN" \
    110 }
    111 
    112 /*!
    113  * \brief Allocate HA memory block.
    114  *
    115  * \param [in] unit The unit associated with the HA memory.
    116  * \param [in] comp_id Pre-allocated component ID.
    117  * \param [in] sub_id Internal ID managed by the component.
    118  * \param [in] blk_id Given string ID that is associated with the block. This
    119  * ID makes it easier to determine the owner of an HA block.
    120  * \param [out] length This parameter used as input and output. For input it
    121  * specifies the desired memory size. For output it is the actual memory block
    122  * that was allocated. The output value has meaning during warm boot where the
    123  * requested size might be different from the actual size of the block that
    124  * was allocated in previous run.
    125  *
    126  * \return If success the function returns pointer to the desired memory.
    127  * Otherwise it returns NULL.
    128  */
    129 extern void *
    130 bcmi_ltsw_ha_mem_alloc(int unit,
    131                        shr_ha_mod_id comp_id,
    132                        shr_ha_sub_id sub_id,
    133                        const char *blk_id,
    134                        uint32_t *length);
    135 
    136 /*!
    137  * \brief Free previously allocated HA memory block.
    138  *
    139  * \param [in] unit The unit associated with the HA memory.
    140  * \param [in] mem The current block to to free
    141  *
    142  * \return SHR_E_NONE success, otherwise failure.
    143  */
    144 extern int
    145 bcmi_ltsw_ha_mem_free(int unit, void *mem);
    146 
    147 /*!
    148  * \brief Get component name from component ID.
    149  *
    150  * \param [in] name Component name.
    151  *
    152  * \return Component ID or BCMMGMT_MAX_COMP_ID on error.
    153  */
    154 extern uint32_t
    155 bcmi_ltsw_ha_comp_id_from_name(const char *name);
    156 
    157 /*!
    158  * \brief Get component ID from component name.
    159  *
    160  * \param [in] comp_id Component ID.
    161  *
    162  * \return Pointer to component name or NULL on error.
    163  */
    164 extern const char *
    165 bcmi_ltsw_ha_comp_name_from_id(uint32_t comp_id);
    166 
    167 #endif /* BCM_INT_LTSW_HA_H */