algo_ecgm.h (4076B)
1 /** 2 * \file algo_ecgm.h 3 * 4 * Egress congestion algorithms 5 * 6 * this file holds the function definitions for 7 * algorithms requiered by egress congestion module, 8 * including template manager functions for creating 9 * and managing the port profile and interface profile, 10 * holding the thresholds for ecgm managed resources. 11 * 12 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 13 * 14 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 15 */ 16 17 #ifndef ALGO_ECGM_H_INCLUDED 18 /** 19 * { 20 */ 21 #define ALGO_ECGM_H_INCLUDED 22 23 #include <shared/shrextend/shrextend_error.h> 24 #include <bcm_int/dnx/cosq/egress/ecgm.h> 25 #include <bcm_int/dnx/cosq/cosq.h> 26 #include <soc/dnx/dnx_data/auto_generated/dnx_data_ecgm.h> 27 28 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h> 29 30 #ifndef BCM_DNX_SUPPORT 31 #error "This file is for use by DNX (JR2) family only!" 32 #endif 33 34 /** 35 * template name defines for algo ECGM 36 */ 37 #define DNX_ALGO_ECGM_PORT_PROFILE_TEMPLATE "Egress CGM Port Profile Template" 38 #define DNX_ALGO_ECGM_INTERFACE_PROFILE_TEMPLATE "Egress CGM Interface Profile Template" 39 40 /** 41 * Typedefs for port and interface profiles 42 */ 43 typedef struct 44 { 45 dnx_ecgm_uc_thresholds_t unicast_queue[DNX_COSQ_NOF_TC]; 46 dnx_ecgm_uc_thresholds_t unicast_port; 47 dnx_ecgm_mc_queue_resources_t multicast_queue[DNX_COSQ_NOF_TC]; 48 dnx_ecgm_mc_drop_thresholds_t multicast_port; 49 } dnx_ecgm_port_profile_info_t; 50 51 typedef struct 52 { 53 dnx_ecgm_uc_fc_thresholds_t uc_fc; 54 uint32 mc_interface_PDs_drop; 55 } dnx_ecgm_interface_profile_thresholds_t; 56 57 typedef struct 58 { 59 dnx_ecgm_interface_profile_thresholds_t high_priority; 60 dnx_ecgm_interface_profile_thresholds_t low_priority; 61 } dnx_ecgm_interface_profile_info_t; 62 63 /** 64 * port profile template API 65 */ 66 67 /** 68 * \brief - port profile template create. 69 * this function should be called during ecgm module loading 70 * to allow the allocation of ecgm port profiles. 71 * the port profile template manager creates 16 port profiles per core. 72 * 73 * \param [in] unit - chip unit id 74 * 75 * \return - shr_error_e 76 */ 77 78 shr_error_e dnx_algo_ecgm_port_profile_template_create( 79 int unit); 80 81 /** 82 * \brief - port profile template destroy. 83 * this function should be called during device deinit 84 * to free resources allocated for ecgm port profiles template. 85 * 86 * \param [in] unit - chip unit id 87 * 88 * \return - shr_error_e 89 */ 90 shr_error_e dnx_algo_ecgm_port_profile_template_destroy( 91 int unit); 92 93 /** 94 * \brief - port profile template print callback 95 * 96 * \param [in] unit - chip unit id 97 * \param [in] data - data to be printed. must be of type dnx_ecgm_port_profile_info_t. 98 */ 99 void dnx_algo_ecgm_port_profile_print_cb( 100 int unit, 101 const void *data); 102 103 /** 104 * interface profile template API 105 */ 106 107 /** 108 * \brief - interface profile template create function. 109 * creates the template manager for interface profile, 110 * that allows allocation and usage of interface profiles. 111 * 112 * \param [in] unit - chip unit id 113 * 114 * \return - shr_error_e 115 */ 116 shr_error_e dnx_algo_ecgm_interface_profile_template_create( 117 int unit); 118 119 /** 120 * \brief - interface profile template destroy. 121 * this function should be called during device deinit 122 * to free resources allocated for ecgm interface profiles template. 123 * 124 * \param [in] unit - chip unit id 125 * 126 * \return - shr_error_e 127 */ 128 shr_error_e dnx_algo_ecgm_interface_profile_template_destroy( 129 int unit); 130 131 /** 132 * \brief - interface profile template print callback 133 * 134 * \param [in] unit - chip unit id 135 * \param [in] data - data to be printed. must be of type dnx_ecgm_interface_profile_info_t. 136 */ 137 138 void dnx_algo_ecgm_interface_profile_print_cb( 139 int unit, 140 const void *data); 141 142 /** 143 * \brief - print function for port profile in SW state 144 * 145 * \param [in] unit - chip unit id 146 * \param [in] data - data to be printed 147 */ 148 void dnx_algo_ecgm_port_profile_info_print( 149 int unit, 150 dnx_ecgm_port_profile_info_t * data); 151 152 /* 153 * } 154 */ 155 #endif /* ALGO_ECGM_H_INCLUDED */