diag_dnx_diag.h (4434B)
1 2 /*! \file diag_dnx_diag.h 3 * Purpose: Extern declarations for command functions and 4 * their associated usage strings. 5 */ 6 /* 7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 8 * 9 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 10 */ 11 12 #ifndef DIAG_DNX_DIAG_H_INCLUDED 13 #define DIAG_DNX_DIAG_H_INCLUDED 14 15 /************* 16 * INCLUDES * 17 */ 18 #include <soc/dnx/dnx_data/auto_generated/dnx_data_device.h> 19 /************* 20 * MACROES * 21 */ 22 #define DNX_DIAG_COUNTER_REG_NOF_REGS (4) 23 /** Length of graphical print buffer */ 24 #define DNX_DIAG_GRAPHICAL_PRINT_BUFFER_LENGTH 50 25 /** Length of block name */ 26 #define DNX_DIAG_BLOCK_NAME_LENGTH 8 27 28 /************* 29 * DEFINES * 30 */ 31 typedef enum 32 { 33 /** block display graphic on left side */ 34 dnx_graphical_nif_rx = 0, 35 dnx_graphical_ire, 36 dnx_graphical_spb, 37 dnx_graphical_ddp, 38 dnx_graphical_cgm, 39 dnx_graphical_ipt, 40 dnx_graphical_fdt, 41 /** block display graphic on right side */ 42 dnx_graphical_nif_tx, 43 dnx_graphical_esb, 44 dnx_graphical_epni, 45 dnx_graphical_pqp, 46 dnx_graphical_rqp, 47 dnx_graphical_fda, 48 dnx_graphical_fdr, 49 /** must be at last */ 50 dnx_graphical_block_count 51 } dnx_diag_graphical_block; 52 typedef struct reason_buffer_s 53 { 54 char buffer[DNX_DIAG_GRAPHICAL_PRINT_BUFFER_LENGTH]; 55 } reason_buffer_t; 56 typedef struct dnx_counter_packet_dropped_reason_s 57 { 58 int nof_reason; 59 char block_name[DNX_DIAG_BLOCK_NAME_LENGTH]; 60 reason_buffer_t *reason_buffer; 61 } dnx_counter_packet_dropped_reason_t; 62 63 /** 64 * \brief 65 * Callback to get drop reason. 66 */ 67 typedef int ( 68 *dnx_dropped_reason_get_f) ( 69 int unit, 70 soc_reg_t reg, 71 soc_field_t field, 72 int cdsp, 73 dnx_counter_packet_dropped_reason_t * dropped_reason); 74 75 /************* 76 * GLOBALS * 77 */ 78 79 /************* 80 * FUNCTIONS * 81 */ 82 /** 83 * \brief 84 * For DNX device only 85 * get CGM drop reason string according to register/field 86 * \param [in] unit - Unit # 87 * \param [in] reg - error counter register 88 * \param [in] field - error counter field 89 * \param [in] cdsp - error counter per core 90 * \param [out] reason - drop reason string 91 * \return 92 * Standard error handling 93 */ 94 shr_error_e dnx_cgm_drop_reason_to_str( 95 int unit, 96 soc_reg_t reg, 97 soc_field_t field, 98 int cdsp, 99 dnx_counter_packet_dropped_reason_t * reason); 100 101 /** 102 * \brief 103 * For DNX device only 104 * get RQP drop reason string according to register/field 105 * \param [in] unit - Unit # 106 * \param [in] reg - error counter register 107 * \param [in] field - error counter field 108 * \param [in] cdsp - error counter per core 109 * \param [out] reason - drop reason string 110 * \return 111 * Standard error handling 112 */ 113 shr_error_e dnx_rqp_drop_reason_to_str( 114 int unit, 115 soc_reg_t reg, 116 soc_field_t field, 117 int cdsp, 118 dnx_counter_packet_dropped_reason_t * reason); 119 120 /** 121 * \brief 122 * For DNX device only 123 * get PQP drop reason string according to register/field 124 * \param [in] unit - Unit # 125 * \param [in] reg - error counter register 126 * \param [in] field - error counter field 127 * \param [in] cdsp - error counter per core 128 * \param [out] reason - drop reason string 129 * \return 130 * Standard error handling 131 */ 132 shr_error_e dnx_pqp_drop_reason_to_str( 133 int unit, 134 soc_reg_t reg, 135 soc_field_t field, 136 int cdsp, 137 dnx_counter_packet_dropped_reason_t * reason); 138 139 /** 140 * \brief 141 * For DNX device only 142 * get ERPP drop reason string according to register/field 143 * \param [in] unit - Unit # 144 * \param [in] reg - error counter register 145 * \param [in] field - error counter field 146 * \param [in] cdsp - error counter per core 147 * \param [out] reason - drop reason string 148 * \return 149 * Standard error handling 150 */ 151 shr_error_e dnx_erpp_drop_reason_to_str( 152 int unit, 153 soc_reg_t reg, 154 soc_field_t field, 155 int cdsp, 156 dnx_counter_packet_dropped_reason_t * reason); 157 158 /** 159 * \brief 160 * For DNX device only 161 * get counter value according to block/counter 162 * \param [in] unit - Unit # 163 * \param [in] name - block name belong to counter register 164 * \param [in] counterName - counter register name 165 * \param [out] counter - counter value 166 * \return 167 * Standard error handling 168 */ 169 shr_error_e dnx_diag_get_counter_specific( 170 int unit, 171 const char *name, 172 const char *counterName, 173 uint64 *counter); 174 175 #endif /* DIAG_DNX_DIAG_H_INCLUDED */