bfd.h (4679B)
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 * File: bfd.h 9 * Purpose: Definitions for BFD. 10 */ 11 12 #ifndef _BCM_INT_BFD_H_ 13 #define _BCM_INT_BFD_H_ 14 15 #if defined(INCLUDE_BFD) 16 17 #include <bcm/bfd.h> 18 19 /* 20 * BFD Function Vector Driver 21 */ 22 typedef struct bcm_esw_bfd_drv_s { 23 /* 24 * BFD APIs 25 */ 26 /* Initalize BFD module */ 27 int (*init)(int unit); 28 /* Detach BFD module */ 29 int (*detach)(int unit); 30 /* Create BFD endpoint */ 31 int (*endpoint_create)(int unit, bcm_bfd_endpoint_info_t *endpoint_info); 32 /* Get BFD endpoint */ 33 int (*endpoint_get)(int unit, bcm_bfd_endpoint_t endpoint, 34 bcm_bfd_endpoint_info_t *endpoint_info); 35 /* Destroy BFD endpoint */ 36 int (*endpoint_destroy)(int unit, bcm_bfd_endpoint_t endpoint); 37 /* Destroy all BFD endpoints */ 38 int (*endpoint_destroy_all)(int unit); 39 /* Generate BFD poll sequence */ 40 int (*endpoint_poll)(int unit, bcm_bfd_endpoint_t endpoint); 41 /* Register BFD callback for event notification */ 42 int (*event_register)(int unit, bcm_bfd_event_types_t event_types, 43 bcm_bfd_event_cb cb, void *user_data); 44 /* Unregister BFD callback */ 45 int (*event_unregister)(int unit, bcm_bfd_event_types_t event_types, 46 bcm_bfd_event_cb cb); 47 /* Get BFD endpoint statistics */ 48 int (*endpoint_stat_get)(int unit, bcm_bfd_endpoint_t endpoint, 49 bcm_bfd_endpoint_stat_t *ctr_info, uint32 options); 50 /* Set BFD SHA1 authentication */ 51 int (*auth_sha1_set)(int unit, int index, bcm_bfd_auth_sha1_t *sha1); 52 /* Get BFD SHA1 authentication */ 53 int (*auth_sha1_get)(int unit, int index, bcm_bfd_auth_sha1_t *sha1); 54 /* Set BFD Simple Password authentication */ 55 int (*auth_simple_password_set)(int unit, int index, 56 bcm_bfd_auth_simple_password_t *sp); 57 /* Get BFD Simple Password authentication */ 58 int (*auth_simple_password_get)(int unit, int index, 59 bcm_bfd_auth_simple_password_t *sp); 60 #ifdef BCM_WARM_BOOT_SUPPORT 61 /* BFD Warm boot sync */ 62 int (*bfd_sync)(int unit); 63 64 int (*_bfd_wb_downgrade_config_set)(int unit, uint32 warmboot_ver); 65 #endif /* BCM_WARM_BOOT_SUPPORT */ 66 67 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 68 /* BFD sessions dump support */ 69 void (*bfd_sw_dump)(int unit); 70 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 71 /* Start TX BFD PDUs */ 72 int (*tx_start)(int unit); 73 /* Stop TX BFD PDUs */ 74 int (*tx_stop)(int unit); 75 /* bfd_status_multi_get */ 76 int (*bfd_status_multi_get)(int unit, int max_endpoints, 77 bcm_bfd_status_t *status_arr, 78 int *count); 79 int (*bfd_discard_stat_set) (int unit, 80 bcm_bfd_discard_stat_t *discarded_info); 81 int (*bfd_discard_stat_get) (int unit, 82 bcm_bfd_discard_stat_t *discarded_info); 83 /* Dump uC backtrace */ 84 void (*bfd_dump_trace)(int unit); 85 } bcm_esw_bfd_drv_t; 86 87 extern bcm_esw_bfd_drv_t *bcm_esw_bfd_drv[BCM_MAX_NUM_UNITS]; 88 89 #define BCM_ESW_BFD_DRV(_u) (bcm_esw_bfd_drv[(_u)]) 90 91 92 /* 93 * Default BFD RX Event Notification thread priority 94 */ 95 #define BCM_ESW_BFD_THREAD_PRI_DFLT 200 96 97 #ifdef BCM_WARM_BOOT_SUPPORT 98 int _bcm_esw_bfd_sync(int unit); 99 100 int _bcm_esw_bfd_wb_downgrade_config_set(int unit, uint32 warmboot_ver); 101 102 #define BCM_BFD_WB_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 103 #define BCM_BFD_WB_VERSION_1_1 SOC_SCACHE_VERSION(1,1) 104 #define BCM_BFD_WB_VERSION_1_2 SOC_SCACHE_VERSION(1,2) 105 #define BCM_BFD_WB_VERSION_1_3 SOC_SCACHE_VERSION(1,3) 106 #define BCM_BFD_WB_VERSION_1_4 SOC_SCACHE_VERSION(1,4) 107 #define BCM_BFD_WB_VERSION_1_5 SOC_SCACHE_VERSION(1,5) 108 #define BCM_BFD_WB_VERSION_1_6 SOC_SCACHE_VERSION(1,6) 109 #define BCM_BFD_WB_DEFAULT_VERSION BCM_BFD_WB_VERSION_1_6 110 111 #define VERSION_1_2_EGRESS_LABEL_SIZE 48 112 113 #endif /* BCM_WARM_BOOT_SUPPORT */ 114 115 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 116 void _bcm_bfd_sw_dump(int unit); 117 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 118 119 void _bcm_bfd_dump_trace(int unit); 120 121 /* 122 * BFD Feature Enable Bit Flags 123 */ 124 #define BFD_MHOP_FEATURE_ENABLE (1 << 0) 125 #define BFD_MICRO_FEATURE_ENABLE (1 << 1) 126 #define BFD_ECHO_FEATURE_ENABLE (1 << 2) 127 128 #define BFD_ECHO_DEST_PORT 3785 129 #define BFD_UDP_MULTI_HOP_DEST_PORT 4784 130 #define MICRO_BFD_DEST_PORT 6784 131 132 #endif /* INCLUDE_BFD */ 133 134 #endif /* _BCM_INT_BFD_H_ */