rx_los.h (4001B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * RX LOS 9 */ 10 11 12 #ifndef _RX_LOS_H_INCLUDED_ 13 #define _RX_LOS_H_INCLUDED_ 14 15 #include <soc/types.h> 16 #include <bcm/port.h> 17 18 /* 19 *RX LOS application - default values 20 */ 21 #define RX_LOS_THREAD_PRIORITY_DEFAULT (1) 22 #define RX_LOS_SHORT_SLEEP_DEFAULT (500000) 23 #define RX_LOS_LONG_SLEEP_DEFAULT (5000000) 24 #define RX_LOS_ALLOWED_RETRIES_DEFAULT (5) 25 #define RX_LOS_LINK_DOWN_CYCLE_COUNT_DEFAULT (1) 26 #define RX_LOS_LINK_DOWN_CYCLE_TIME_DEFAULT (0) 27 #define RX_LOS_RX_SEQ_CHANGE_CYCLE_COUNT_DEFAULT (5) 28 #define RX_LOS_RX_SEQ_CHANGE_CYCLE_TIME_DEFAULT (5000000) 29 #define RX_LOS_PBMP_DEFAULT(unit, pbmp) { \ 30 SOC_PBMP_CLEAR(pbmp); \ 31 if (SOC_IS_DFE(unit)) { \ 32 SOC_PBMP_OR(pbmp, PBMP_SFI_ALL(unit)); \ 33 } else if (SOC_IS_ARAD(unit)) { \ 34 SOC_PBMP_OR(pbmp, PBMP_SFI_ALL(unit)); \ 35 SOC_PBMP_OR(pbmp, PBMP_IL_ALL(unit)); \ 36 SOC_PBMP_OR(pbmp, PBMP_CE_ALL(unit)); \ 37 SOC_PBMP_OR(pbmp, PBMP_XL_ALL(unit)); \ 38 SOC_PBMP_OR(pbmp, PBMP_XE_ALL(unit)); \ 39 SOC_PBMP_OR(pbmp, PBMP_GE_ALL(unit)); \ 40 } \ 41 } 42 43 /* 44 * RX LOS application - defines 45 */ 46 /*rx_los_generic_unit_detach flags*/ 47 #define RX_LOS_GENERIC_UNIT_DETACH_F_SW_ONLY (0x1) 48 49 /*rx_los_generic_port_enable flags*/ 50 #define RX_LOS_GENERIC_PORT_ENABLE_F_SW_ONLY (0x1) 51 52 /* 53 * RX LOS port states 54 */ 55 typedef enum rx_los_state_e { 56 rx_los_state_ideal_state = 0, 57 rx_los_state_no_signal, 58 rx_los_state_no_signal_active, /*no signal state with polling over rx_seq_done*/ 59 rx_los_state_rx_seq_change, 60 rx_los_state_sleep_one, 61 rx_los_state_restart, 62 rx_los_state_sleep_two, 63 rx_los_state_link_up_check, 64 rx_los_state_long_sleep, 65 rx_los_states_count 66 } rx_los_state_t; 67 68 /* 69 * Functions 70 */ 71 int rx_los_set_config(uint32 short_sleep_usec, uint32 long_sleep_usec, uint32 allowed_retries, uint32 priority, int link_down_count_max, int link_down_cycle_time); 72 int rx_los_mac_rxlostofsync_interrupt_set_config(int unit, int interrupt_occurences, int cycle_time); 73 int rx_los_port_enable(int unit, bcm_port_t port, int enable, int warm_boot); 74 int rx_los_generic_port_enable(int unit, bcm_port_t port, int enable, int warm_boot, uint32 flags); 75 int rx_los_unit_attach(int unit, const pbmp_t pbmp, int warm_boot); 76 int rx_los_enable_get(int unit, bcm_pbmp_t *pbmp, int *enable); 77 int rx_los_unit_detach(int unit); 78 int rx_los_sw_unit_detach(int unit); 79 int rx_los_generic_unit_detach(int unit, uint32 flags); 80 int rx_los_handle(int unit, int port); 81 int rx_los_exit_thread(void); 82 int rx_loss_appl_enable(int unit); 83 int rx_los_dump(int unit); 84 int rx_los_dump_port(int unit, bcm_port_t port); 85 int rx_los_set_active_sleep_config(uint32 active_sleep_usec); 86 87 /* 88 * RX LOS callback register 89 * 90 * RX LOS application will call the callback when a port move to a stable or active stable state: 91 * * rx_los_state_ideal_state 92 * * rx_los_state_no_signal 93 * * rx_los_state_no_signal_active 94 */ 95 96 typedef void (*rx_los_callback_t) (int unit, bcm_port_t port, rx_los_state_t state); 97 int rx_los_register(int unit, rx_los_callback_t callback); 98 99 /* 100 * RX LOS - wait for stable port 101 * RX LOS api will when a port is in a stable or active stable state: 102 * * rx_los_state_ideal_state 103 * * rx_los_state_no_signal 104 * * rx_los_state_no_signal_active 105 * 106 * If port is not supported by RX LOS the API will return state=rx_los_states_count. 107 * max time to wait: timeout 108 */ 109 int rx_los_port_stable(int unit, bcm_port_t port, int timeout_usec, rx_los_state_t *state); 110 111 #endif /*_RX_LOS_H_INCLUDED_*/