bhh_msg.h (9682B)
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: bhh_msg.h 8 * Purpose: BHH Messages definitions common to SDK and uKernel. 9 * 10 * Messages between SDK and uKernel. 11 */ 12 13 #ifndef _SOC_SHARED_BHH_MSG_H_ 14 #define _SOC_SHARED_BHH_MSG_H_ 15 16 #ifdef BCM_UKERNEL 17 /* Build for uKernel not SDK */ 18 #include "sdk_typedefs.h" 19 #else 20 #include <sal/types.h> 21 #endif 22 23 #include <soc/shared/mos_msg_common.h> 24 #include <shared/bhh.h> 25 #include <soc/shared/oam_pm_pack.h> 26 27 28 /******************************** 29 * BHH Control Messages 30 * 31 * SDK Host <--> uController 32 */ 33 34 #define SHR_BHH_CARRIER_CODE_LEN 6 35 36 /* 37 * BHH Initialization control message 38 */ 39 typedef struct shr_bhh_msg_ctrl_init_s { 40 uint32 num_sessions; /* Max number of BHH sessions */ 41 uint32 rx_channel; /* Local RX DMA channel (0..3) */ 42 uint32 node_id; /* Node ident */ 43 uint8 carrier_code[SHR_BHH_CARRIER_CODE_LEN]; 44 } shr_bhh_msg_ctrl_init_t; 45 46 /* 47 * BHH Encapsulation control message 48 * 49 * Encapsulation Maximum length 50 * OLP Tx(34) + L2(22) + 9 labels(36) + ACH(4) = 96 51 * 52 * 53 * BHH Encapsulation Table 54 * 55 * The BHH Encapsulation is maintained in the uKernel 56 * It contains the encapsulation for all current BHH sessions. 57 * 58 * A BHH encapsulation does NOT include the BHH PDU (BHH Control Packet). 59 * This is built by the uKernel side. 60 */ 61 #define SHR_BHH_MAX_ENCAP_LENGTH 162 62 #define SHR_BHH_MEG_ID_LENGTH 48 63 64 /* 65 * BHH Session Set control message 66 */ 67 typedef struct shr_bhh_msg_ctrl_sess_enable_s { 68 uint32 sess_id; 69 uint32 flags; 70 uint16 remote_mep_id; 71 uint8 enable; 72 } shr_bhh_msg_ctrl_sess_enable_t; 73 74 75 /* 76 * BHH Session delete control message 77 */ 78 typedef struct shr_bhh_msg_ctrl_sess_delete_s { 79 uint32 sess_id; 80 } shr_bhh_msg_ctrl_sess_delete_t; 81 82 83 /* 84 * BHH Session Set control message 85 */ 86 typedef struct shr_bhh_msg_ctrl_sess_set_s { 87 uint32 sess_id; 88 uint32 flags; 89 uint8 passive; 90 uint8 mel; /* MEG level */ 91 uint16 mep_id; 92 uint8 meg_id[SHR_BHH_MEG_ID_LENGTH]; 93 uint32 period; 94 uint8 encap_type; /* Raw, UDP-IPv4/IPv6, used for UDP checksum */ 95 uint32 encap_length; /* BHH encapsulation length */ 96 uint8 encap_data[SHR_BHH_MAX_ENCAP_LENGTH]; /* Encapsulation data */ 97 uint32 tx_port; 98 uint32 tx_cos; 99 uint32 tx_pri; 100 uint32 tx_qnum; 101 uint32 mpls_label; 102 uint32 if_num; 103 uint32 lm_counter_index; 104 } shr_bhh_msg_ctrl_sess_set_t; 105 106 107 /* 108 * BHH Session Get control message 109 */ 110 typedef struct shr_bhh_msg_ctrl_sess_get_s { 111 uint32 sess_id; 112 uint8 enable; 113 uint8 passive; 114 uint8 local_demand; 115 uint8 remote_demand; 116 uint8 local_sess_state; 117 uint8 remote_sess_state; 118 uint8 mel; 119 uint16 mep_id; 120 uint8 meg_id[SHR_BHH_MEG_ID_LENGTH]; 121 uint32 period; 122 uint8 encap_type; /* Raw, UDP-IPv4/IPv6, used for UDP checksum */ 123 uint32 encap_length; /* BHH encapsulation length */ 124 uint8 encap_data[SHR_BHH_MAX_ENCAP_LENGTH]; /* Encapsulation data */ 125 uint32 tx_port; 126 uint32 tx_cos; 127 uint32 tx_pri; 128 uint32 tx_qnum; 129 } shr_bhh_msg_ctrl_sess_get_t; 130 131 132 /* 133 * BHH Statistics control messages (Request/Reply) 134 */ 135 typedef struct shr_bhh_msg_ctrl_stat_req_s { 136 uint32 sess_id; /* BHH session (endpoint) id */ 137 uint32 clear; /* Clear stats */ 138 } shr_bhh_msg_ctrl_stat_req_t; 139 140 typedef struct shr_bhh_msg_ctrl_stat_reply_s { 141 uint32 sess_id; /* BHH session (endpoint) id */ 142 uint32 packets_in; /* Total packets in */ 143 uint32 packets_out; /* Total packets out */ 144 uint32 packets_drop; /* Total packets drop */ 145 uint32 packets_auth_drop; /* Packets drop due to authentication failure */ 146 } shr_bhh_msg_ctrl_stat_reply_t; 147 148 /* 149 * BHH Loopback add 150 */ 151 typedef struct shr_bhh_msg_ctrl_loopback_add_s { 152 uint32 flags; 153 uint32 sess_id; /* BHH session (endpoint) id */ 154 uint32 period; 155 uint32 ttl; 156 } shr_bhh_msg_ctrl_loopback_add_t; 157 158 /* 159 * BHH Loopback delete 160 */ 161 typedef struct shr_bhh_msg_ctrl_loopback_delete_s { 162 uint32 sess_id; /* BHH session (endpoint) id */ 163 } shr_bhh_msg_ctrl_loopback_delete_t; 164 165 /* 166 * BHH Loopback get 167 */ 168 typedef struct shr_bhh_msg_ctrl_loopback_get_s { 169 uint32 flags; 170 uint32 sess_id; /* BHH session (endpoint) id */ 171 uint32 period; 172 uint32 ttl; 173 uint32 discovery_flags; 174 uint32 discovery_id; 175 uint32 discovery_ttl; 176 uint32 rx_count; 177 uint32 tx_count; 178 uint32 drop_count; 179 uint32 unexpected_response; 180 uint32 out_of_sequence; 181 uint32 local_mipid_missmatch; 182 uint32 remote_mipid_missmatch; 183 uint32 invalid_target_mep_tlv; 184 uint32 invalid_mep_tlv_subtype; 185 uint32 invalid_tlv_offset; 186 } shr_bhh_msg_ctrl_loopback_get_t; 187 188 /* 189 * BHH Loss Measurement add 190 */ 191 typedef struct shr_bhh_msg_ctrl_loss_add_s { 192 uint32 flags; 193 uint32 sess_id; /* BHH session (endpoint) id */ 194 uint32 period; 195 uint32 int_pri; 196 uint8 pkt_pri; 197 } shr_bhh_msg_ctrl_loss_add_t; 198 199 /* 200 * BHH Loss Measurement delete 201 */ 202 typedef struct shr_bhh_msg_ctrl_loss_delete_s { 203 uint32 sess_id; /* BHH session (endpoint) id */ 204 } shr_bhh_msg_ctrl_loss_delete_t; 205 206 /* 207 * BHH Loss Measurement get 208 */ 209 typedef struct shr_bhh_msg_ctrl_loss_get_s { 210 uint32 flags; 211 uint32 sess_id; /* BHH session (endpoint) id */ 212 uint32 period; 213 uint32 loss_threshold; 214 uint32 loss_nearend; 215 uint32 loss_farend; 216 uint32 tx_nearend; 217 uint32 rx_nearend; 218 uint32 tx_farend; 219 uint32 rx_farend; 220 uint32 rx_oam_packets; 221 uint32 tx_oam_packets; 222 uint32 int_pri; 223 uint8 pkt_pri; 224 } shr_bhh_msg_ctrl_loss_get_t; 225 226 /* 227 * BHH Delay Measurement add 228 */ 229 typedef struct shr_bhh_msg_ctrl_delay_add_s { 230 uint32 flags; 231 uint32 sess_id; /* BHH session (endpoint) id */ 232 uint32 period; 233 uint32 int_pri; 234 uint8 pkt_pri; 235 uint8 dm_format; 236 } shr_bhh_msg_ctrl_delay_add_t; 237 238 /* 239 * BHH Delay Measurement delete 240 */ 241 typedef struct shr_bhh_msg_ctrl_delay_delete_s { 242 uint32 sess_id; /* BHH session (endpoint) id */ 243 } shr_bhh_msg_ctrl_delay_delete_t; 244 245 /* 246 * BHH Delay Measurement get 247 */ 248 typedef struct shr_bhh_msg_ctrl_delay_get_s { 249 uint32 flags; 250 uint32 sess_id; /* BHH session (endpoint) id */ 251 uint32 period; 252 uint32 delay_seconds; 253 uint32 delay_nanoseconds; 254 uint32 txf_seconds; 255 uint32 txf_nanoseconds; 256 uint32 rxf_seconds; 257 uint32 rxf_nanoseconds; 258 uint32 txb_seconds; 259 uint32 txb_nanoseconds; 260 uint32 rxb_seconds; 261 uint32 rxb_nanoseconds; 262 uint32 rx_oam_packets; 263 uint32 tx_oam_packets; 264 uint32 int_pri; 265 uint8 pkt_pri; 266 uint8 dm_format; 267 } shr_bhh_msg_ctrl_delay_get_t; 268 269 typedef shr_oam_pm_msg_ctrl_pm_stats_get_t shr_bhh_msg_ctrl_pm_stats_get_t; 270 271 /* 272 * BHH control messages 273 */ 274 typedef union shr_bhh_msg_ctrl_s { 275 shr_bhh_msg_ctrl_init_t init; 276 shr_bhh_msg_ctrl_sess_set_t sess_set; 277 shr_bhh_msg_ctrl_sess_get_t sess_get; 278 shr_bhh_msg_ctrl_sess_delete_t sess_delete; 279 shr_bhh_msg_ctrl_stat_req_t stat_req; 280 shr_bhh_msg_ctrl_stat_reply_t stat_reply; 281 shr_bhh_msg_ctrl_loopback_add_t loopback_add; 282 shr_bhh_msg_ctrl_loopback_get_t loopback_get; 283 shr_bhh_msg_ctrl_pm_stats_get_t pm_stats_get; 284 } shr_bhh_msg_ctrl_t; 285 286 287 /**************************************** 288 * BHH event message 289 */ 290 #define BHH_BTE_EVENT_LB_TIMEOUT 0x000001 291 #define BHH_BTE_EVENT_LB_DISCOVERY_UPDATE 0x000002 292 #define BHH_BTE_EVENT_CCM_TIMEOUT 0x000004 293 #define BHH_BTE_EVENT_STATE 0x000008 294 #define BHH_BTE_EVENT_CCM_RDI 0x000010 295 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEG_LEVEL 0x000020 296 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEG_ID 0x000040 297 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEP_ID 0x000080 298 #define BHH_BTE_EVENT_CCM_UNKNOWN_PERIOD 0x000100 299 #define BHH_BTE_EVENT_CCM_UNKNOWN_PRIORITY 0x000200 300 #define BHH_BTE_EVENT_CCM_RDI_CLEAR 0x000400 301 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEG_LEVEL_CLEAR 0x000800 302 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEG_ID_CLEAR 0x001000 303 #define BHH_BTE_EVENT_CCM_UNKNOWN_MEP_ID_CLEAR 0x002000 304 #define BHH_BTE_EVENT_CCM_UNKNOWN_PERIOD_CLEAR 0x004000 305 #define BHH_BTE_EVENT_CCM_UNKNOWN_PRIORITY_CLEAR 0x008000 306 #define BHH_BTE_EVENT_CCM_TIMEOUT_CLEAR 0x010000 307 #define BHH_BTE_EVENT_PM_STATS_COUNTER_ROLLOVER 0x020000 308 #define BHH_BTE_EVENT_CSF_LOS 0x040000 309 #define BHH_BTE_EVENT_CSF_FDI 0x080000 310 #define BHH_BTE_EVENT_CSF_RDI 0x100000 311 #define BHH_BTE_EVENT_CSF_DCI 0x200000 312 313 314 #define BHH_BTE_CSF_FAULTS (BHH_BTE_EVENT_CSF_LOS | \ 315 BHH_BTE_EVENT_CSF_FDI | \ 316 BHH_BTE_EVENT_CSF_RDI) 317 /* 318 * The BHH event message is defined as a short message (use mos_msg_data_t). 319 * 320 * The fields of mos_msg_data_t are used as followed: 321 * mclass (uint8) - MOS_MSG_CLASS_BHH_EVENT 322 * subclass (uint8) - Unused 323 * len (uint16) - BHH Session ID 324 * data (uint32) - Events mask 325 */ 326 typedef mos_msg_data_t bhh_msg_event_t; 327 328 #define SHR_BHH_MAX_PORTS 128 329 #define SHR_BHH_INVALID_TRUNK_ID 0xFFFF 330 331 #endif /* _SOC_SHARED_BHH_MSG_H_ */