oam_pm_pack.h (7287B)
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-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: oam_pm_pack.h 8 * Purpose: OAM_PM definitions common to SDK and uKernel 9 * 10 * Notes: Definition changes should be avoided in order to 11 * maintain compatibility between SDK and uKernel since 12 * both images are built and loaded separately. 13 */ 14 15 #ifndef _SOC_SHARED_OAM_PM_PACK_H 16 #define _SOC_SHARED_OAM_PM_PACK_H 17 18 #ifdef BCM_UKERNEL 19 /* Build for uKernel not SDK */ 20 #include "sdk_typedefs.h" 21 #else 22 #include <sal/types.h> 23 #endif 24 25 26 #define _PM_UC_MSG_TIMEOUT_USECS 5000000 27 28 /***************************************** 29 * OAM_PM uController Error codes 30 */ 31 typedef enum shr_oam_pm_uc_error_e { 32 SHR_OAM_PM_UC_E_NONE = 0, 33 SHR_OAM_PM_UC_E_INTERNAL, 34 SHR_OAM_PM_UC_E_MEMORY, 35 SHR_OAM_PM_UC_E_PARAM, 36 SHR_OAM_PM_UC_E_RESOURCE, 37 SHR_OAM_PM_UC_E_EXISTS, 38 SHR_OAM_PM_UC_E_NOT_FOUND, 39 SHR_OAM_PM_UC_E_UNAVAIL, 40 SHR_OAM_PM_UC_E_VERSION, 41 SHR_OAM_PM_UC_E_INIT 42 } shr_oam_pm_uc_error_t; 43 44 /* 45 * Macro: 46 * SHR_OAM_PM_IF_ERROR_RETURN 47 * Purpose: 48 * Evaluate _op as an expression, and if an error, return. 49 * Notes: 50 * This macro uses a do-while construct to maintain expected 51 * "C" blocking, and evaluates "op" ONLY ONCE so it may be 52 * a function call that has side affects. 53 */ 54 55 #define SHR_OAM_PM_IF_ERROR_RETURN(op) \ 56 do { \ 57 int __rv__; \ 58 if ((__rv__ = (op)) != SHR_OAM_PM_UC_E_NONE) { \ 59 return(__rv__); \ 60 } \ 61 } while(0) 62 63 64 #define SHR_OAM_PM_MAX_PM_BIN_EDGES 7 65 /* 66 * OAM_PM PM stats get 67 */ 68 typedef struct shr_oam_pm_msg_ctrl_pm_stats_get_s { 69 uint32 flags; 70 uint32 sess_id; /* OAM_PM session (endpoint) id */ 71 uint32 far_loss_min; /* Minimum Frame loss at far-end */ 72 uint32 far_tx_min; /* Minimum Frames transmitted at far-end */ 73 uint32 far_loss_max; /* Maximum Frame loss at far-end */ 74 uint32 far_tx_max; /* Maximum Frames transmitted at far-end*/ 75 uint32 far_loss; /* Total far loss at far-end */ 76 uint32 near_loss_min; /* Minimum Frame loss at at near-end */ 77 uint32 near_tx_min; /* Minimum Frames transmitted at near-end */ 78 uint32 near_loss_max; /* Maximum Frame loss at near-end */ 79 uint32 near_tx_max; /* Maximum Frames transmitted at near-end */ 80 uint32 near_loss; /* Total near loss at near-end */ 81 uint32 lm_tx_count; /* Count of LM packets transmitted from local node */ 82 /* during sampling interval*/ 83 uint32 DM_min; /* Minimum Frame pm_stats */ 84 uint32 DM_max; /* Maximum Frame pm_stats */ 85 uint32 DM_avg; /* Frame pm_stats */ 86 uint32 dm_tx_count; /* Count of DM packets transmitted from local node */ 87 /* during sampling interval*/ 88 uint8 profile_id; /* Profile number associated with this session */ 89 /* to measure the DM frames Delay */ 90 /* which will fall into associated bins pm_stats range*/ 91 uint32 bin_counters[SHR_OAM_PM_MAX_PM_BIN_EDGES+1]; /* Bins Count of */ 92 /*associated profile */ 93 uint32 lm_rx_count; /* Count of LM packets received in local 94 node during sampling interval */ 95 uint32 dm_rx_count; /* Count of DM packets received in local 96 node during sampling interval */ 97 uint32 far_total_tx_pkt_count; /* Total Tx data packets at far-end */ 98 uint32 near_total_tx_pkt_count; /* Total Tx data packets at near-end */ 99 100 } shr_oam_pm_msg_ctrl_pm_stats_get_t; 101 102 # define SHR_OAM_PM_RAW_DATA_MAX_SAMPLES 10 /* Maximum number of samples in each buffer in Raw sampling mode */ 103 104 typedef struct oam_pm_raw_counter_s { 105 uint32 tx_fcf; /* Count of packets transmitted local node */ 106 uint32 rx_fcf; /* Count of packets received by remote node */ 107 uint32 tx_fcb; /* Count of packets transmitted by remote node */ 108 uint32 rx_fcb; /* Count of packets received by local node */ 109 } oam_pm_raw_counter_t; 110 111 typedef struct oam_pm_raw_timestamp_s { 112 uint32 tx_tsf_secs; /* Time stamp upper of DM packets transmitted local node */ 113 uint32 tx_tsf_nsecs; /* Time stamp lower of DM packets transmitted local node */ 114 uint32 rx_tsf_secs; /* Time stamp upper of DM packets received by remote node */ 115 uint32 rx_tsf_nsecs; /* Time stamp lower of DM packets received by remote node */ 116 uint32 tx_tsb_secs; /* Time stamp upper of DM packets transmitted by remote node */ 117 uint32 tx_tsb_nsecs; /* Time stamp lower of DM packets transmitted by remote node */ 118 uint32 rx_tsb_secs; /* Time stamp upper of DM packets received by local node */ 119 uint32 rx_tsb_nsecs; /* Time stamp lower of DM packets received by local node */ 120 } oam_pm_raw_timestamp_t; 121 122 typedef struct oam_pm_raw_samples_s { 123 uint32 pm_id; /* Performance measurement ID in BTE*/ 124 uint32 lm_count; /* Number of LM samples collected as part of this buffer*/ 125 uint32 dm_count; /* Number of DM samples collected as part of this buffer*/ 126 oam_pm_raw_counter_t raw_counter[SHR_OAM_PM_RAW_DATA_MAX_SAMPLES]; /* LM counters collected as part of this buffer*/ 127 oam_pm_raw_timestamp_t raw_timestamp[SHR_OAM_PM_RAW_DATA_MAX_SAMPLES]; /* DM Timestamps collected as part of this buffer*/ 128 } oam_pm_raw_sample_t; 129 130 # define SHR_OAM_MAX_PM_ENDPOINTS 256 131 132 /* 133 * OAM PM Raw data buffer object 134 */ 135 136 typedef struct shr_oam_pm_msg_ctrl_raw_buffer_s { 137 uint32 seq_num; /* Seq No. of the data buffer */ 138 oam_pm_raw_sample_t raw_sample[SHR_OAM_MAX_PM_ENDPOINTS]; /* Raw data buffer */ 139 } shr_oam_pm_msg_ctrl_raw_buffer_t; 140 141 /* 142 * OAM PM control messages 143 */ 144 typedef union shr_oam_pm_msg_ctrl_s { 145 shr_oam_pm_msg_ctrl_raw_buffer_t raw_buffer; 146 } shr_oam_pm_msg_ctrl_t; 147 148 149 /* 150 * OAM PM profile attach control message 151 */ 152 typedef struct shr_oam_pm_msg_ctrl_profile_attach_s { 153 uint32 sess_id; 154 uint32 profile_flags; 155 uint8 profile_id; 156 uint32 profile_edges[SHR_OAM_PM_MAX_PM_BIN_EDGES]; 157 } shr_oam_pm_msg_ctrl_profile_attach_t; 158 159 extern uint8 * 160 shr_oam_pm_msg_ctrl_pm_stats_get_pack(uint8 *buf, 161 shr_oam_pm_msg_ctrl_pm_stats_get_t *msg); 162 extern uint8 * 163 shr_oam_pm_msg_ctrl_pm_stats_get_unpack(uint8 *buf, 164 shr_oam_pm_msg_ctrl_pm_stats_get_t *msg, 165 uint8 pm_stat_extra_elem_feature); 166 extern uint8 * 167 shr_oam_pm_msg_ctrl_profile_attach_pack(uint8 *buf, 168 shr_oam_pm_msg_ctrl_profile_attach_t *msg); 169 extern uint8 * 170 shr_oam_pm_msg_ctrl_profile_attach_unpack(uint8 *buf, 171 shr_oam_pm_msg_ctrl_profile_attach_t *msg); 172 extern uint8 * 173 shr_oam_pm_msg_ctrl_raw_buffer_unpack(uint8 *buf, 174 shr_oam_pm_msg_ctrl_raw_buffer_t *msg); 175 #endif /* _SOC_SHARED_OAM_PM_PACK_H */