diff options
author | Maria Matejka <mq@ucw.cz> | 2022-02-02 11:20:53 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-02-03 10:30:33 +0100 |
commit | d262695d4e8ddee7b9408bb726b4100f68d217d7 (patch) | |
tree | 9ff1286e67892bbbf3abf75eeebacb2f0afc538f /proto/bfd/bfd.h | |
parent | 09380db594e1befb991be626b36783cae525d823 (diff) |
BFD: direct notifications to protocol loops
Diffstat (limited to 'proto/bfd/bfd.h')
-rw-r--r-- | proto/bfd/bfd.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/proto/bfd/bfd.h b/proto/bfd/bfd.h index 475b3a11..b3266857 100644 --- a/proto/bfd/bfd.h +++ b/proto/bfd/bfd.h @@ -88,18 +88,12 @@ struct bfd_proto { struct proto p; - pthread_spinlock_t lock; - node bfd_node; slab *session_slab; HASH(struct bfd_session) session_hash_id; HASH(struct bfd_session) session_hash_ip; - sock *notify_rs; - sock *notify_ws; - list notify_list; - sock *rx4_1; sock *rx6_1; sock *rx4_m; @@ -122,7 +116,6 @@ struct bfd_iface struct bfd_session { - node n; ip_addr addr; /* Address of session */ struct bfd_iface *ifa; /* Iface associated with session */ struct bfd_session *next_id; /* Next in bfd.session_hash_id */ @@ -133,14 +126,15 @@ struct bfd_session u8 poll_active; u8 poll_scheduled; - u8 loc_state; - u8 rem_state; - u8 loc_diag; - u8 rem_diag; + _Atomic struct bfd_session_state loc; + struct bfd_session_state rem; +#define BFD_LOC_STATE(s) atomic_load_explicit(&(s)->loc, memory_order_relaxed) + u32 loc_id; /* Local session ID (local discriminator) */ u32 rem_id; /* Remote session ID (remote discriminator) */ - struct bfd_session_config cf; /* Static configuration parameters */ + struct bfd_session_config cf; /* Static configuration parameers */ + event update_event; /* Reconfiguration requested */ u32 des_min_tx_int; /* Desired min rx interval, local option */ u32 des_min_tx_new; /* Used for des_min_tx_int change */ @@ -162,6 +156,7 @@ struct bfd_session list request_list; /* List of client requests (struct bfd_request) */ btime last_state_change; /* Time of last state change */ + btime last_reqlist_check; /* Time of last check whether the request list is not empty */ u8 notify_running; /* 1 if notify hooks are running */ u8 rx_csn_known; /* Received crypto sequence number is known */ @@ -208,10 +203,6 @@ extern const char *bfd_state_names[]; extern const u8 bfd_auth_type_to_hash_alg[]; - -static inline void bfd_lock_sessions(struct bfd_proto *p) { pthread_spin_lock(&p->lock); } -static inline void bfd_unlock_sessions(struct bfd_proto *p) { pthread_spin_unlock(&p->lock); } - /* bfd.c */ struct bfd_session * bfd_find_session_by_id(struct bfd_proto *p, u32 id); struct bfd_session * bfd_find_session_by_addr(struct bfd_proto *p, ip_addr addr, uint ifindex); |