19 #ifndef __included_bfd_main_h__ 20 #define __included_bfd_main_h__ 29 #define foreach_bfd_mode(F) \ 35 #define F(x) BFD_MODE_##x, 58 #define foreach_bfd_poll_state(F) \ 62 F (IN_PROGRESS_AND_QUEUED) 66 #define F(x) BFD_POLL_##x, 74 #define foreach_bfd_hop(F) \ 75 F (SINGLE, "single") \ 80 #define F(sym, str) BFD_HOP_TYPE_##sym, 245 #define foreach_bfd_listen_event(F) \ 246 F (CREATE, "sesion-created") \ 247 F (UPDATE, "session-updated") \ 248 F (DELETE, "session-deleted") 252 #define F(sym, str) BFD_LISTEN_EVENT_##sym, 328 #define foreach_bfd_error(F) \ 329 F (NONE, "good bfd packets (processed)") \ 330 F (BAD, "invalid bfd packets") \ 331 F (DISABLED, "bfd packets received on disabled interfaces") 335 #define F(sym, str) BFD_ERROR_##sym, 361 u64 expire_time_clocks;
370 uword my_thread_index = __os_thread_index;
387 uword my_thread_index = __os_thread_index;
428 u8 bfd_key_id,
u8 is_delayed);
431 u32 desired_min_tx_usec,
432 u32 required_min_rx_usec,
438 #define USEC_PER_MS 1000LL 439 #define USEC_PER_SECOND (1000 * USEC_PER_MS) 442 #define BFD_DEFAULT_DESIRED_MIN_TX_USEC USEC_PER_SECOND 448 #define BFD_REQUIRED_MIN_RX_USEC_WHILE_ECHO USEC_PER_SECOND
bfd_notify_fn_t * listeners
vector of callback notification functions
bfd_auth_type_e auth_type
authentication type for this key
u8 curr_bfd_key_id
current key ID sent out in bfd packet
bfd_session_t * bfd_get_session(bfd_main_t *bm, bfd_transport_e t)
struct bfd_session_s bfd_session_t
u32 * auth_key_by_conf_key_id
hashmap - index in pool auth_keys by conf_key_id
u64 echo_last_rx_clocks
timestamp of last echo packet received
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
u32 echo_secret
secret used for calculating/checking checksum of echo packets
bfd_session_t * bfd_find_session_by_idx(bfd_main_t *bm, uword bs_idx)
bfd_diag_code_e local_diag
local diagnostics
#define foreach_bfd_hop(F)
hop types
#define foreach_bfd_listen_event(F)
listener events
u64 last_tx_clocks
timestamp of last packet transmitted
void bfd_register_listener(bfd_notify_fn_t fn)
Register a callback function to receive session notifications.
u8 remote_seq_number_known
set to 1 if remote sequence number is known
static void bfd_unlock(bfd_main_t *bm)
int bfd_verify_pkt_common(const bfd_pkt_t *pkt)
verify bfd packet - common checks
typedef CLIB_PACKED(struct { u32 discriminator;u64 expire_time_clocks;u64 checksum;}) bfd_echo_pkt_t
echo packet structure
u32 bfd_process_node_index
background process node index
u64 remote_min_echo_rx_clocks
remote min echo rx interval (clocks)
u64 effective_required_min_rx_clocks
effective required min rx interval (clocks)
void bfd_put_session(bfd_main_t *bm, bfd_session_t *bs)
#define foreach_bfd_mode(F)
vlib_log_class_t log_class
log class
u8 * bfd_input_format_trace(u8 *s, va_list *args)
u32 remote_seq_number
remote sequence number
unsigned bfd_auth_type_supported(bfd_auth_type_e auth_type)
timing_wheel_t wheel
timing wheel for scheduling timeouts
u64 effective_desired_min_tx_clocks
effective desired min tx interval (clocks)
static void bfd_lock_check(bfd_main_t *bm)
u64 bfd_process_next_wakeup_clocks
When the bfd process is supposed to wake up next.
u32 random_seed
for generating random numbers
int bfd_verify_pkt_auth(const bfd_pkt_t *pkt, u16 pkt_size, bfd_session_t *bs)
verify bfd packet - authentication
#define foreach_bfd_error(F)
Packet counters.
void bfd_consume_pkt(bfd_main_t *bm, const bfd_pkt_t *bfd, u32 bs_idx)
u64 remote_min_rx_usec
remote min rx interval (microseconds)
UDP transport specific data embedded in bfd_session's union.
u64 tx_timeout_clocks
next time at which to transmit a packet
int bfd_consume_echo_pkt(bfd_main_t *bm, vlib_buffer_t *b)
u64 config_required_min_rx_clocks
configured required min rx interval (clocks)
bfd_auth_key_t * next_key
set to next key to use if delayed switch is enabled - in that case the key is switched when first inc...
void bfd_event(bfd_main_t *bm, bfd_session_t *bs)
void bfd_session_set_flags(bfd_session_t *bs, u8 admin_up_down)
u8 remote_demand
1 if remote system sets demand mode, 0 otherwise
bfd_session_t * sessions
pool of bfd sessions context data
bfd_auth_key_t * auth_keys
pool of authentication keys
bfd_transport_e transport
transport type for this session
u32 remote_discr
remote discriminator
u64 default_desired_min_tx_clocks
default desired min tx in clocks
u64 echo_last_tx_clocks
timestamp of last echo packet transmitted
bfd_poll_state_e poll_state
state info regarding poll sequence
u8 * format_bfd_session_brief(u8 *s, va_list *args)
f64 cpu_cps
cpu clocks per second
u8 * format_bfd_session(u8 *s, va_list *args)
u64 echo_tx_timeout_clocks
next time at which to transmit echo packet
u8 local_detect_mult
configured detect multiplier
vnet_api_error_t bfd_auth_deactivate(bfd_session_t *bs, u8 is_delayed)
u64 last_rx_clocks
timestamp of last packet received
bfd_diag_code_e remote_diag
remote diagnostics
vnet_api_error_t bfd_session_set_params(bfd_main_t *bm, bfd_session_t *bs, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult)
u64 transmit_interval_clocks
transmit interval
#define foreach_bfd_poll_state(F)
vnet_api_error_t bfd_auth_activate(bfd_session_t *bs, u32 conf_key_id, u8 bfd_key_id, u8 is_delayed)
BFD protocol declarations.
struct bfd_session_s::@52 auth
authentication information
u32 config_desired_min_tx_usec
configured desired min tx interval (microseconds)
#define clib_warning(format, args...)
u64 poll_state_start_or_timeout_clocks
helper for delayed poll sequence - marks either start of running poll sequence or timeout...
u64 detection_time_clocks
detection time
void bfd_session_start(bfd_main_t *bm, bfd_session_t *bs)
u64 config_desired_min_tx_clocks
configured desired min tx interval (clocks)
u64 bfd_process_wakeup_event_start_clocks
The timestamp of last wakeup event being sent.
u32 bfd_clocks_to_usec(const bfd_main_t *bm, u64 clocks)
u8 echo
1 is echo function is active, 0 otherwise
u64 wheel_time_clocks
set to value of timer in timing wheel, 0 if never set
u64 remote_desired_min_tx_clocks
remote desired min tx interval (clocks)
u8 * format_bfd_auth_key(u8 *s, va_list *args)
u32 local_discr
local discriminator
bfd_hop_type_e hop_type
BFD hop type.
u32 conf_key_id
global configuration key ID
vlib_main_t * vlib_main
convenience variables
bfd_state_e local_state
session state
u32 * session_by_disc
hashmap - bfd session by discriminator
void(* bfd_notify_fn_t)(bfd_listen_event_e, const bfd_session_t *)
session nitification call back function type
u64 echo_transmit_interval_clocks
transmit interval for echo packets
u32 local_seq_number
sequence number incremented occasionally or always (if meticulous)
u32 config_required_min_rx_usec
configured required min rx interval (microseconds)
BFD UDP transport layer declarations.
void bfd_init_final_control_frame(vlib_main_t *vm, vlib_buffer_t *b, bfd_main_t *bm, bfd_session_t *bs, int is_local)
u32 use_count
keeps track of how many sessions reference this key
VLIB buffer representation.
u8 next_bfd_key_id
key ID to use when switched to next_key
int bfd_process_wakeup_events_in_flight
Number of event wakeup RPCs in flight.
u64 bfd_process_wakeup_event_delay_clocks
The time it took the last wakeup event to make it to handling.
u32 bs_idx
index in bfd_main.sessions pool
u64 remote_min_echo_rx_usec
remote min echo rx interval (microseconds)
bfd_state_e remote_state
remote session state
bfd_session_t * bfd_find_session_by_disc(bfd_main_t *bm, u32 disc)
const char * bfd_poll_state_string(bfd_poll_state_e state)
u64 min_required_min_rx_while_echo_clocks
minimum required min rx while echo function is active - clocks
bfd_auth_key_t * curr_key
current key in use
clib_spinlock_t lock
lock to protect data structures
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
u8 remote_detect_mult
remote detect multiplier
u64 remote_min_rx_clocks
remote min rx interval (clocks)
u8 is_delayed
set to 1 if delayed action is pending, which might be activation of authentication, change of key or deactivation
static void bfd_lock(bfd_main_t *bm)
u64 wheel_inaccuracy
timing wheel inaccuracy, in clocks