issu.h (5956B)
1 /*! \file issu.h 2 * 3 * BCM internal APIs for ISSU (a.k.a. In Service Software Upgrade). 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 12 #ifndef BCMI_LTSW_ISSU_H 13 #define BCMI_LTSW_ISSU_H 14 15 #include <sal/sal_types.h> 16 #include <bcmissu/issu_api.h> 17 18 /*! 19 * \brief ISSU upgrade start. 20 * 21 * This function initiates the ISSU process. It starts by loading the ISSU DLL. 22 * It laters informs the system manager engine about the ongoing update by 23 * assigning values to callback functions being executed during the pre config 24 * stage. 25 * 26 * \param [in] from_ver Is the previous version of software that was running. 27 * \param [in] to_ver Is the version of the current software. 28 * 29 * \return SHR_E_NONE on success and error code otherwise. 30 */ 31 extern int 32 bcmi_ltsw_issu_upgrade_start(const char *from_ver, const char *to_ver); 33 34 /*! 35 * \brief ISSU upgrade done. 36 * 37 * This function releases all the resources that were used by the ISSU. In 38 * particular it unloads the ISSU DLL. It is assume that this function is being 39 * called once all the units had completed their upgrade. 40 * 41 * \return SHR_E_NONE on success and error code otherwise. 42 */ 43 extern int 44 bcmi_ltsw_issu_upgrade_done(void); 45 46 /*! 47 * \brief Initialize the ISSU structure and update HA while warmboot enabled. 48 * 49 * \param [in] unit The unit associated with the HA memory. 50 * 51 * \return SHR_E_NONE on success and error code otherwise. 52 */ 53 extern int 54 bcmi_ltsw_issu_init(int unit); 55 56 /*! 57 * \brief Detach the ISSU structure control DB. 58 * 59 * This function detaches the ISSU structure control DB by freeing some 60 * resources that were used in the DB operations. 61 * 62 * \param [in] unit The unit associated with the structure control DB. 63 * 64 * \retval The calculated size of the structure. 65 */ 66 extern int 67 bcmi_ltsw_issu_detach(int unit); 68 69 /*! 70 * \brief Inform the ISSU the location of a data structure within the HA block. 71 * 72 * Through this function a component can inform the ISSU manager about the 73 * location of a known HA data structure within an HA memory block. This 74 * information is being used during the ISSU process where the ISSU manager 75 * determines if a particular data structure has changed and therefore needs 76 * to be updated to the new structure while maintaining the previous values. 77 * 78 * \param [in] unit The unit associated with the HA memory. 79 * \param [in] comp_id Is the component ID that allocated the HA block. 80 * \param [in] sub_id Is the sub module ID that together with the \c comp_id 81 * identifies the HA block. 82 * \param [in] offset The number of bytes from the beginning of the HA block 83 * where the structure is being located. 84 * \param [in] data_size the space occupied by the structure. If a structure 85 * contains unbounded array this parameter should include the actual size of 86 * the unbounded array. 87 * \param [in] instances The number of reported structures in the array. 88 * \param [in] id An automatically generated unique ID for the data structure. 89 * 90 * \return SHR_E_NONE success, otherwise SHR_E_PARAM due to wrong parameters. 91 */ 92 extern int 93 bcmi_ltsw_issu_struct_info_report(int unit, 94 shr_ha_mod_id comp_id, 95 shr_ha_sub_id sub_id, 96 uint32_t offset, 97 uint32_t data_size, 98 size_t instances, 99 bcmissu_struct_id_t id); 100 101 /*! 102 * \brief Retrieve the location of a data structure within an HA memory block. 103 * 104 * The purpose of this function is to retrieve the location of an HA data 105 * structure that was previously reported to the HA manager via 106 * \ref shr_ha_struct_report() function. 107 * This function should only be called during warm boot where the component 108 * needs to find out the location of its own structures within HA memory. This 109 * functionality is particularly important after software upgrade where the 110 * locations of the structures can shift within the block due to the upgrade 111 * migration process. 112 * 113 * \param [in] unit The unit associated with the HA memory. 114 * \param [in] id Unique generated structure ID. 115 * \param [in] comp_id Is the component ID that allocated the HA block. 116 * \param [in] sub_id Is the sub module ID that together with the \c comp_id 117 * identifies the HA block. 118 * \param [out] offset The offset from the beginning of the block were the 119 * data structure is located. 120 * 121 * \retval SHR_E_NONE on success. 122 * \retval SHR_E_INTERNAL Internal data structure mismatch. 123 * \retval SHR_E_NOT_FOUND The structure ID was not found. 124 */ 125 extern int 126 bcmi_ltsw_issu_struct_info_get(int unit, 127 bcmissu_struct_id_t id, 128 shr_ha_mod_id comp_id, 129 shr_ha_sub_id sub_id, 130 uint32_t *offset); 131 132 /*! 133 * \brief Clear the location of a structure in HA memory block. 134 * 135 * This function is the inverse of the function \ref shr_ha_struct_report(). 136 * It indicates that a specific data structure is no longer available within 137 * the provided HA memory block. 138 * 139 * \param [in] unit The unit associated with the HA memory. 140 * \param [in] id Unique generated structure ID. 141 * \param [in] comp_id Is the component ID that allocated the HA block. 142 * \param [in] sub_id Is the sub module ID that together with the \c comp_id 143 * identifies the HA block. 144 * 145 * \retval SHR_E_NONE on success. 146 * \retval SHR_E_INTERNAL Internal data structure mismatch. 147 * \retval SHR_E_NOT_FOUND The structure ID was not found. 148 */ 149 extern int 150 bcmi_ltsw_issu_struct_info_clear(int unit, 151 bcmissu_struct_id_t id, 152 shr_ha_mod_id comp_id, 153 shr_ha_sub_id sub_id); 154 155 #endif /* BCMI_LTSW_ISSU_H */